Skip to content

TimeSeries.plot ignores color kwarg #1890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andreas-h opened this issue Sep 11, 2012 · 6 comments
Closed

TimeSeries.plot ignores color kwarg #1890

andreas-h opened this issue Sep 11, 2012 · 6 comments
Labels
Milestone

Comments

@andreas-h
Copy link
Contributor

I know this looks like a duplicate of #1636, but even with pandas 0.8.1, I don't get the expected plotting behaviour:

In [1]: from numpy import arange

In [2]: import matplotlib.pyplot as plt

In [3]: import pandas

In [4]: pandas.__version__
Out[4]: '0.8.1'

In [5]: plt.figure()
Out[5]: <matplotlib.figure.Figure at 0x33afd50>

In [6]: plt.plot(arange(12), arange(12), color='green')     # this line is green
Out[6]: [<matplotlib.lines.Line2D at 0x337c150>]

In [7]: pandas.Series(arange(12) + 1).plot(color='green')   # this line is blue
Out[7]: <matplotlib.axes.AxesSubplot at 0x33c80d0>
@wesm wesm closed this as completed in 33bb84b Sep 12, 2012
@wesm
Copy link
Member

wesm commented Sep 12, 2012

thanks for the report. indeed this was not fixed by #1636 and has been remedied here

yarikoptic added a commit to neurodebian/pandas that referenced this issue Sep 27, 2012
* commit 'v0.8.1-203-g67121af': (193 commits)
  BUG: DataFrame column formatting issue in length-truncated column close pandas-dev#1906
  BUG: override min/max in DatetimeIndex to function as expected close pandas-dev#1895
  BUG: DataFrame mixed-type arithmetic column-wise, fix DataFrame.diff upcasting->object bug close pandas-dev#1896
  BUG: treat nobs=1 >= min_periods case in rolling_std/variance as 0 trivially. close pandas-dev#1884
  TST: skip to_file test if URLError occurs on some systems
  VB: resolve test name conflict and update make script
  DOC: minor change to build script to help auto build process
  DOC: fixed extlinks in sphinx conf
  TST: oops import in wrong place
  TST: skip test_console_encode if sys.stdin.encoding is None
  TST: unit test for pandas-dev#1902 and default to csv.QUOTE_MINIMAL
  Make it possible to set quoting for to_csv
  ENH: clean up pandas-dev#1691 changes, rls note
  ENH: add more possible bool values to read_csv pandas-dev#1295
  BUG: fix rolling_max/min for small inputs and large windows. Add a check that the min_period <= window size. Fixes pandas-dev#1897.
  Mention Ubuntu for NeuroDebian repository
  BUG: don't clobber color keyword in Series.plot, close pandas-dev#1890
  DOC: add intersphinx mapping for python library, close pandas-dev#1556
  BUG: fix mixed-integer .ix indexing bugs. close#1799
  BUG: unicode sheet name in to_excel pandas-dev#1828
  ...
brendam added a commit to brendam/pandas that referenced this issue Oct 7, 2012
@jorisvandenbossche
Copy link
Member

Is it possoble this bug is not yet fixed? I think it is for a normal series, but not for a timeseries as mentioned in the title. An example in the same way as above:

In [9]: pandas.Series(np.arange(12) + 1).plot(color='green')  # this line is indeed green now
Out[9]: <matplotlib.axes.AxesSubplot at 0x55d1e70>

In [12]: pandas.Series(np.arange(12) + 1, index=pandas.date_range('1/1/2000', periods=12)).plot(color='green')  # this is still blue
Out[12]: <matplotlib.axes.AxesSubplot at 0x58a8850>

And a bigger example (the case where I experienced it): http://nbviewer.ipython.org/3857689/

@brendam
Copy link
Contributor

brendam commented Oct 9, 2012

It is still a problem. I've submitted a patch, which is waiting for review. A work around is to add style='b' to the plot statement. eg:
pandas.Series(np.arange(12) + 1, index=pandas.date_range('1/1/2000', periods=12)).plot(style='b', color='green')

@jorisvandenbossche
Copy link
Member

OK, thanks!

@wesm wesm reopened this Oct 10, 2012
@wesm
Copy link
Member

wesm commented Oct 10, 2012

reopened til patch is merged

wesm added a commit that referenced this issue Oct 31, 2012
* brendam/fix-color-kwarg:
  remove call to self._get_colors() from inside _maybe_add_color() - not efficient
  remove comment
  refactor plotting.py to only have _maybe_add_color defined once
  fixed color keyword in time series plot - issue #1890
@wesm
Copy link
Member

wesm commented Oct 31, 2012

merged the PR. I think we're good to go

@wesm wesm closed this as completed Oct 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants