6

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 ?

elia
  • 239
  • 3
  • 16
  • Could this be of any help? https://stackoverflow.com/questions/7125009/how-to-change-legend-size-with-matplotlib-pyplot – errata May 26 '17 at 11:19
  • What exactly are you trying to control? It seems the label `Ideal` is in the legend. Do you only want to change the size of one of the legend labels? Please also add a [MCVE]. – tmdavison May 26 '17 at 11:25
  • @tom the size of the patches in general – elia May 26 '17 at 11:31
  • @errata I found a similar approach in the question you provided. write the answer as:` plot.legend(......,prop={'size':6})` so i can choose your answer, and thanks – elia May 26 '17 at 11:36

1 Answers1

5

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)
    
ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712