'Increase the size of plot in plot.barh
I have a dataframe df , and need to increase the size of the plot,i am using the following code. Any way to change the font and colour of the plot and lables.
df.plot.barh(x='name',y='sales',title='graph');
Solution 1:[1]
As mentioned by @Ezer, you can add figsize(w,l) to change the plot size
To change the colors, you can add this for specific colors. List of colors is available here
The font size and style be changed as show in code below
import matplotlib.pyplot as plt
import pandas as pd
from itertools import cycle, islice
colors = list(islice(cycle(['b', 'r', 'g', 'y', 'k']), None, len(df)))
ax= df.plot.barh((x='name',y='sales', figsize(10,5), color=colors)
x.set_title('Graphs', fontname='Franklin Gothic Medium', fontsize=20)
ax.set_xlabel('Name', fontname='Times New Roman', fontsize=16)
ax.set_ylabel('Sales', fontname='Arial', fontsize=16)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
