some markers missing from legend · Issue #14958 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
Your code here
import numpy as np import pandas as pd import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randn(8, 3), columns=['A', 'B', 'C']) ax = df.plot (y=['A'], marker='x', linestyle='solid') df.plot (y=['B'], marker='o', linestyle='dotted', ax=ax) df.plot (y=['C'], marker='<', linestyle='dotted', ax=ax) plt.grid() plt.show()
Problem description
The legend is missing some markers.
If I add
plt.legend()
then they show up.
See attached
figure1.pdf
[this should explain why the current behaviour is a problem and why the expected output is a better solution.]
Expected Output
Output of pd.show_versions()
# Paste the output here pd.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.5.2.final.0 python-bits: 64 OS: Linux OS-release: 4.8.14-300.fc25.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8
pandas: 0.19.1
nose: 1.3.7
pip: 9.0.1
setuptools: 31.0.0
Cython: 0.25.2
numpy: 1.12.0rc1
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: 1.5
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.1
matplotlib: 2.0.0rc2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.5.1
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None