BUG: when adding multiple plots with different cmap, colorbars legends use first cmap · Issue #33389 · pandas-dev/pandas (original) (raw)
For example, when doing twice a scatter plot with a different colormap, it adds a colorbar for each, but with the wrong colors:
df = pd.DataFrame({'x': [1, 2, 3], 'y': [1, 3, 2], 'c': [1, 2, 3]}
df['x2'] = df['x'] + 1
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
df.plot('x', 'y', c='c', kind='scatter', cmap="cividis", ax=ax)
df.plot('x2', 'y', c='c', kind='scatter', cmap="magma", ax=ax)