Skip to content
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

BUG: don't plot colorbar if c is column containing colors #34316

Closed
3 tasks done
MarcoGorelli opened this issue May 22, 2020 · 0 comments · Fixed by #34344
Closed
3 tasks done

BUG: don't plot colorbar if c is column containing colors #34316

MarcoGorelli opened this issue May 22, 2020 · 0 comments · Fixed by #34344
Assignees
Labels
Milestone

Comments

@MarcoGorelli
Copy link
Member

MarcoGorelli commented May 22, 2020

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

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

  • (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

import matplotlib as mpl
import numpy as np

import pandas as pd

CMAP = "viridis"
df = pd.DataFrame(
    [[5.1, 3.5], [4.9, 3.0], [7.0, 3.2], [6.4, 3.2], [5.9, 3.0]],
    columns=["length", "width"],
)
df["species"] = ['r', 'r', 'g', 'g', 'b']
df.plot.scatter(
    x=0, y=1, c="species", cmap=CMAP,
)

Problem description

This produces
image

The colorbar to the right of the plot doesn't make any sense here

Expected Output

Same plot, but without the colorbar

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 6ad157e
python : 3.8.2.final.0
python-bits : 64
OS : Linux
OS-release : 5.3.0-51-generic
Version : #44~18.04.2-Ubuntu SMP Thu Apr 23 14:27:18 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 1.1.0.dev0+1623.g6ad157e93
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.1.3.post20200325
Cython : 0.29.16
pytest : 5.4.1
hypothesis : 5.8.0
sphinx : 3.0.0
blosc : None
feather : None
xlsxwriter : 1.2.8
lxml.etree : 4.5.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.13.0
pandas_datareader: None
bs4 : 4.9.0
bottleneck : 1.3.2
fastparquet : 0.3.3
gcsfs : None
matplotlib : 3.2.1
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.4.1
sqlalchemy : 1.3.16
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.15.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.48.0

@MarcoGorelli MarcoGorelli added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 22, 2020
@charlesdong1991 charlesdong1991 added Visualization plotting and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels May 22, 2020
@MarcoGorelli MarcoGorelli self-assigned this May 23, 2020
@MarcoGorelli MarcoGorelli changed the title BUG: Remove colorbar from scatterplot if c is not a column name BUG: don't plot colorbar if c is column containing colors May 25, 2020
@jreback jreback added this to the 1.1 milestone Jun 14, 2020
@jreback jreback added the Bug label Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants