Matplotlib custom calls windows font library

created at 07-13-2021 views: 4

fonts in windows

The file of the font library is in .tff format
The windows pc terminal basically reaches the various fonts we need
First you need to find out where it is:


find fonts

Take my most commonly used Aria font as an example, double click to enter
there will be the following files

Aria font

specify font

Then call the Arial regular file as an example, upload this .tff file to the server (I plot diagrams on the terminal)

from matplotlib.font_manager import FontProperties
font = FontProperties(fname='/home/wangnan/arial.ttf')
plt.xlabel('My Label', FontProperties=font,size=22)
plt.yticks(FontProperties=font, size = 16) #xy-axis scale numbers
plt.xticks(FontProperties=font, size = 16)


If you want to change the font of the colorbar scale, you can define another tick to cover it.

cb1.set_label(r'$\mathrm{\Delta O_{3}\_CHEM\ by\ BVOCs\ (ppb)}$', FontProperties=font,size=18)
#This step is very important,35,10),FontProperties=font,size=16) 


created at:07-13-2021
edited at: 07-14-2021: