Skip to content

BUG: color list passed in as list/array/series of colors only picks up first color. #40605

@RT-Tap

Description

@RT-Tap

So I found this issue was fixed in 2017 and 2019 respectively, however I think it's back. I spent half the day trying to figure out what I was doing wrong until I stumbled upon this thread/report: #16822
And it seems like the bug may have crawled its way back in? Sorry if I should not have opened a new bug report however you mentioned opening a new bug report for the 2019 reports of this bug so I figured I would report that it might be back as well.

  • [x ] I have checked that this issue has not already been reported.

  • [x ] I have confirmed this bug exists on the latest version of pandas.

  • [x ] (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

fullColors = list(itertools.repeat('#3FD21C',10)) + list(itertools.repeat('#ED5851',25))
df.plot(kind='bar', logy='sym', color=fullColors)
plt.show()

Problem description

So I have a dataframe with 1 data column and an index column, the dataframe has 50 values/rows in it and when i pass in a list of 50 colors I would expect those colors get matched up with each bar (or in my case half the bars are one color and half another) however only the first color passed in gets used to color all of the bars.

Expected Output

A bar graph with multiple colored bars rather than just 1 color

Output of pd.show_versions()

INSTALLED VERSIONS

commit : f2c8480
python : 3.8.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252

pandas : 1.2.3
numpy : 1.18.5
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 52.0.0.post20210125
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.21.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.4
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.1
sqlalchemy : 1.3.18
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugClosing CandidateMay be closeable, needs more eyeballsNeeds InfoClarification about behavior needed to assess issueVisualizationplotting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions