A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/10299 below:

Cannot use hex strings or named matplotlib colors with DataFrame.plot · Issue #10299 · pandas-dev/pandas · GitHub

I was going to put this on SO but I think it might belong here instead:

I have a pandas DataFrame where I want to plot each column as a line with the same color. This might sound useless but I am showing groups of lines from certain selections of the DataFrame. The only problem is it appears that the DataFrame.plot method does not accept any matplotlib hex strings or named colors in the color kwarg.

A trivial example:

pd.DataFrame([range(10),range(10)]).plot(color='#008000')

gives a blank subplot with no errors, however,

pd.DataFrame([range(10),range(10)]).plot(color='g')

gives the expected result. To me this seems like a bug considering that color='g' works but not its hex string equivalent. The same issue occurs when trying to use a named matplotlib color like color='lightgray'. This does however work when using Series.plot or DataFrame.plot with one column or if a list of hex strings or named colors are given with length equal to the number of columns as in,

pd.DataFrame([range(10),range(10)]).plot(color=['#008000']*2)

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