K G
K G

Reputation: 1815

Subplot colours by column in `pandas`

I am creating a pandas plot using the following code:

plt = table. \
    reindex_axis(index, axis=1). \
    T. \
    plot. \
    bar(
        subplots=True,
        rot=45,
        stacked=False,
        color=colors,
        width=.4,
        legend=False,
        figsize=(20, 10),
        layout=(3, 4),
        sharex=False,
    )

This gives me plots like this: subplots

Want I want is more like this: stacked

Now I'm quite fine with the bars not being stacked but I really would like the colours to be the same. How can I do that?

Upvotes: 0

Views: 473

Answers (1)

ilia timofeev
ilia timofeev

Reputation: 1119

Color param accepts colors for each subplot as array.

    color=[colors,colors,colors],

In you case will be enough just one item in a list

    color=[colors],

Upvotes: 3

Related Questions