[英]How can I stop matplotlib from showing an extra year or month?
For example, I have this array: 例如,我有这个数组:
ncdf1['level'].loc['2017':'2017']
<xarray.DataArray 'level' (time: 246)>
array([302.52 , 302.42 , 302.3 , ..., 310.07 , 310.74 , 309.723])
Coordinates:
* time (time) datetime64[ns] 2017-01-01 2017-01-02 ... 2017-12-21
But when I try to plot it, I get an extra month (or year if try for multiple years): 但是,当我尝试绘制它时,我得到了一个额外的月份(如果尝试多年则为一年):
ncdat['level'].loc['2017':'2017'].plot(color='#1f78b4')
How can I automatically make the plot from Jan-Dec? 如何自动绘制从1月到12月的地块?
ncdat
<xarray.Dataset>
Dimensions: (time: 4680)
Coordinates:
* time (time) datetime64[ns] 2005-01-01 2005-01-02 ... 2019-05-09
Data variables:
level (time) float64 307.7 307.4 307.2 307.0 ... 300.4 301.3 303.2 303.0
storage (time) float64 0.02 0.02 0.02 0.02 0.02 ... 0.001 0.001 0.007 0.006
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.