I'm attempting to plot data from a .csv file and I want it to put less values down the Y-axis.
This is the output I am getting at the moment:
I would also like the numbers to be automatically rounded or neatened up to make the plot more readable.
def GraphBuilder():
item = 0
savenumber = 1
ColumnTime = itemgetter(0)(column_names)
while item < col_count:
SecondaryColumn = itemgetter(item)(column_names)
ColumnTimeData = pandagraph[ColumnTime]
SecondaryColumnData = pandagraph[(SecondaryColumn)]
plt.xlim([0, 1000])
plt.ylim([-100, 100000])
plt.ylabel(SecondaryColumn)
plt.plot(ColumnTimeData, SecondaryColumnData)
plt.xticks(rotation = 45)
print("Starting new graph")
Start = 0
End = 0
Start = time.time()
plt.savefig(f"Graph{savenumber}.tiff")
plt.close()
plt.cla()
plt.clf()
print(f"Graph {savenumber} completed")
End = time.time()
TotalGraphTime = End - Start
TotalGraphTime = round(TotalGraphTime, 2)
print("Graph completed in: ", TotalGraphTime, " Seconds.")
time.sleep(0.1)
item += 1
savenumber +=1
I'm not sure how to make the program do this so any help is greatly appreciated.
要更改刻度数,我建议查看 plt.yticks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.