[英]how to show all 12 month in x axis?
I want to plot something with respect of 12 months.我想 plot 12 个月的东西。 but in figure in x axis, it does not show all 12 month.
但在 x 轴的图中,它并未显示所有 12 个月。 what I have to do in order to x axis be based on all 12 months?
为了使 x 轴基于所有 12 个月,我必须做什么?
My code is as follows我的代码如下
plt.plot_date(tezos2018['Date'],tezos2018['Market Cap'], linestyle='solid',xdate=True)
plt.gcf().autofmt_xdate()
date=dates.DateFormatter( '%b , %d, %Y')
plt.gca().xaxis.set_major_formatter(date)
which outputs哪个输出
matplotlib.dates.MonthLocator(bymonth=None, bymonthday=1, interval=1, tz=None)
class: matplotlib.dates.MonthLocator(bymonth=None, bymonthday=1, interval=1, tz=None)
class: Make ticks on occurrences of each month, eg, 1, 3, 12.在每个月的出现上打勾,例如 1、3、12。
Mark every month in bymonth;按月标记每个月; bymonth can be an int or sequence.
bymonth 可以是 int 或序列。 Default is range(1,13), ie every month.
默认为 range(1,13),即每个月。
interval is the interval between each iteration.间隔是每次迭代之间的间隔。 For example, if interval=2, mark every second occurrence.
例如,如果间隔 = 2,则每隔一秒标记一次。
import matplotlib.dates as mdates
plt.plot_date(tezos2018['Date'],tezos2018['Market Cap'], linestyle='solid',xdate=True)
plt.gcf().autofmt_xdate()
date=dates.DateFormatter( '%b , %d, %Y')
plt.gca().xaxis.set_major_formatter(date)
plt.gca().xaxis.set_major_locator(mdates.MonthLocator())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.