A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://stackoverflow.com/questions/33559772/is-this-a-bug-of-series-plot-in-pandas-0-17 below:

python - Is this a bug of `Series.plot` in pandas 0.17?

I always use ser.plot(xticks=range(0, len(ser), step), ..) to plot figures with specified xticks. But it doesn't work anymore in pandas 0.17 when the Series with labels. Here are the codes:

In [1]: from numpy import random as rnd 
In [2]: import pandas as pd
In [3]: pd.__version__
Out[3]: '0.17.0'
In [4]: %matplotlib inline
In [5]: rnd.seed(123)
In [6]: ser = pd.Series(rnd.randn(73).cumsum(), index=['P%02d' % i for i in range(73)])
In [7]: ser.plot(figsize=(9, 6), rot=60, title='Figure without xticks')
Out[7]: <matplotlib.axes._subplots.AxesSubplot at 0x8370198

In [8]ser.plot(figsize=(9, 6), xticks=list(range(0, 73, 6)), rot=60, title='Figure with xticks')
Out[8]: <matplotlib.axes._subplots.AxesSubplot at 0x83e9940>

And the same code in pandas 0.16:

In [1]: from numpy import random as rnd
In [2]: import pandas as pd
In [3]: pd.__version__
Out[3]: '0.16.0'
In [4]: %matplotlib inline
In [5]: rnd.seed(123)
In [6]: ser = pd.Series(rnd.randn(73).cumsum(), index=['P%02d' % i for i in range(73)])
In [8]: ser.plot(figsize=(9, 6), xticks=list(range(0, 73, 6)), rot=60, title='Figure with xticks')
Out[8]: <matplotlib.axes._subplots.AxesSubplot at 0xbbf19b0>


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4