简体   繁体   English

Python图形图问题

[英]Python graph plot issue

I am trying to plot a time-series data, but I'm facing some issue while plotting them like when I'm using function 我正在尝试绘制时间序列数据,但是在像使用函数时那样在绘制它们时遇到了一些问题

pyplot.plot(ts)

graph is like 图就像

使用功能的第一个情节

But when I'm using following function of python on same data then graph is like this 但是当我在相同的数据上使用python的以下功能时,图是这样的

ts.plot()

第二张图

I'm totally confused because of this. 因此,我感到非常困惑。 Any idea about this error? 对这个错误有任何想法吗?

Without the df, I can only make a guess. 没有df,我只能猜测。 You should order the column which contains the dates. 您应该对包含日期的列进行排序。 Try to apply this to the column of x-axis where the dates are: 尝试将其应用于日期为x-axis的列:

df = df.sort_values(by='your_column') #'your_column' is the columns with dates

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM