Hi. I am using PyGMT to draw map. Using fig.text()
, I could add option font=10p,Helevetica-Bold
to use the GMT default font, but unfortunately, Arial is not included as the default GMT font. However, I should use Arial because of journal guideline for figure. In this case, I have two questions.
-
How can I use Arial in PyGMT if I have the downloaded font in .ttf
format?
-
How can I set the desired font for all texts such as numbers and labels and not only for fig.text()
? Is it possible to set kind of “default” font for entire PyGMT (it seems that Helvetica is the default) by adding option to pygmt.config()
?
Currently, I only set pygmt.config(FORMAT_GEO_MAP="ddd.x")
to draw the map.
A little bit complicated, I don’t have a full solution, but to get you started:
-
To use a non-default font, see https://docs.generic-mapping-tools.org/6.2/cookbook/postscript-fonts.html#using-non-default-fonts-with-gmt and https://docs.generic-mapping-tools.org/latest/gallery/ex31.html#example-31 for ideas. I’m not sure if a .ttf file would work, but maybe someone else on the forum will know.
-
To use the new font for all text, do pygmt.config(FONT="Arial")
. The FONT
config should change all the font to the one you set. As an aside, the list of available postscript fonts are at https://docs.generic-mapping-tools.org/latest/cookbook/postscript-fonts.html.
An alternative way would be to save your figure as a vector format (e.g. eps/pdf) and edit the font in a program like Inkscape or Illustrator. I’m surprised that a journal would have a guideline for the figure’s font type, but if you’re sure that is what they want, then good luck!