Skip to content

DataFrame.plot(subplots=True) forces black-and-white mode regardless of other settings #11536

Closed
@dniku

Description

@dniku
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

df = pd.DataFrame(np.random.randn(6, 4), index=pd.date_range('20150101', periods=6), columns=list('ABCD'))

plotters = [
    "df.plot()",
    "df.plot(legend=None)",
    "df.plot(legend=None, subplots=True, layout=(2, 2))",
    "df['A'].plot(legend=None)",
    "df['A'].plot(legend=None, subplots=True)"
]

for i, plotter in enumerate(plotters, 1):
    eval(plotter)
    plt.title(plotter)
    plt.savefig('%d.png' % i)
    plt.close('all')

Also, notice how the title is broken in the third image.

1

2

3

4

5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions