Skip to content Skip to sidebar Skip to footer

Pandas - How Do I Change The Size And Colors Of A Bar?

I want to increase the size of this bar, and to change the color of number 2 (FEB) or 12 (DES), because they are too similar. How can I do it? THANKS

Solution 1:

For the next time please add your code not as an image! I'm using this small dict:

posts_created = {
    1: {2011: 0, 2012: 92, 2013: 129},
    2: {2011: 0, 2012: 72, 2013: 99},
}

Size

As pandas is using matplotlib you can take a look to the matplotlib documentation.

pd.DataFrame(posts_created).plot.bar(width=0.8)

enter image description here

Color

You can specifiy the color options for each columns like this (see documentation):

pd.DataFrame(posts_created).plot.bar(color={1: "red", 2: "blue"})

enter image description here

Post a Comment for "Pandas - How Do I Change The Size And Colors Of A Bar?"