Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change matplotlib patches Font Size without using mpl.rc() [duplicate]

I'm using matplotlib to generate some graphs, I wanted to have a bigger font for the axis scale so I used :

font = {'size' : 22} matplotlib.rc('font', **font)

This affected my Legends size as in the figure: figure

Is there anyway to control the size of mpatches.Patch() text ?

like image 557
elia Avatar asked May 26 '17 11:05

elia


1 Answers

mpatches.Patch() has no fontsize, since it has no text associated with it.

  • To control the label's fontsize you can use rcParams, like

    plt.rcParams["axes.labelsize"] = 22
    

    or directly control the size of the label

    ax.set_xlabel("some label", fontsize=22)
    
  • To control the legend's fontsize you can use rcParams

    plt.rcParams["legend.fontsize"] = 22
    

    or directly specify the size in the legend

    ax.legend(fontsize=22)
    
like image 155
ImportanceOfBeingErnest Avatar answered Oct 22 '22 14:10

ImportanceOfBeingErnest