Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将地物的x轴标签从每日更改为每年_Python_Pandas_Matplotlib_Plot_Time Series - Fatal编程技术网

Python 将地物的x轴标签从每日更改为每年

Python 将地物的x轴标签从每日更改为每年,python,pandas,matplotlib,plot,time-series,Python,Pandas,Matplotlib,Plot,Time Series,我为时间序列创建了许多图表,我正在努力使用x轴标签 我有从1993年11月开始的每日数据,但在我的x轴上,我只想显示,例如,每3-4年的1月1日,或者仅显示一年的maybbe 有人知道我怎么做吗 另外,我不想显示标签“Timestamp”(time panda列的名称),如何隐藏它 感谢您的帮助 下面是我的示例图的代码: rolling_correlation.plot(x = 'Timestamp', y = ['Average Rolling Correlation'] , color=[

我为时间序列创建了许多图表,我正在努力使用x轴标签

我有从1993年11月开始的每日数据,但在我的x轴上,我只想显示,例如,每3-4年的1月1日,或者仅显示一年的maybbe

有人知道我怎么做吗

另外,我不想显示标签“Timestamp”(time panda列的名称),如何隐藏它

感谢您的帮助

下面是我的示例图的代码:

rolling_correlation.plot(x = 'Timestamp', y = ['Average Rolling Correlation']  , color=['tab:grey'], figsize = (8,6), title = "1-Year Average Correlation of Change in Bond Yield ")
plt.ylim(0, 1)
plt.grid(axis='y')
plt.axvline(1349)
plt.axvline(1872,linestyle='dashed')
plt.axvline(3826)
plt.axvline(4153)
plt.axvline(5480)
plt.axvline(6870)
plt.show()

我想你们已经有了4年的增量,对吗?(如果我错了,请告诉我。)但是,您可以通过执行以下空标记来删除名称:

rolling_correlation.plot(x = '', y = ['Average Rolling Correlation']  , color=['tab:grey'], figsize = (8,6), title = "1-Year Average Correlation of Change in Bond Yield ")

谢谢关于增量:我想稍微修改一下,这样我总是显示相同的日期(2000年1月1日,2004年1月1日,等等)。这有点随机。有一个类似的问题。