Here's my chart:
I have two issues; I can't get the datetime objects on the x-axis to come out nicely (ie January 1st, 2013) and I would like the y-axis labels to be absolute values, not log values.
Here's my annotated code: ( date_sorted
is my Pandas dataframe)
fig = plt.figure()
date_sorted.plot( x = ["ReleaseDate"], y = ["DomesticTotalGross"])
plt.title("Domestic Total Gross over Time")
plt.xticks(rotation=45)
plt.yscale('linear') # ---- this doesn't seem to do anything
plt.ticklabel_format(useOffset=False) #--- this gives this error: AttributeError: This method only works with the ScalarFormatter.
fig.autofmt_xdate() #thought this was supposed to convert my x-axis datetime objects into nice dates?
关于日期格式,一种实现目标的方法是将索引重置为日期格式,而不是日期时间:
date_sorted.set_index([ts.date for ts in date_sorted.index]).plot(x="ReleaseDate", y="DomesticTotalGross")
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.