How do you control the font size of a figure that is used in an academic publication?

Hi, everyone! I wonder how do you control the font size of a figure that is used in an academic publication, for example, if we plot the figure with Makie and write a paper with LaTex?

Usually, we can tune in Julia both the size of a figure and the font size in it, and in LaTex we can also tune the size of the inserted figure using e.g., \includegraphics[width=0.6\textwidth]{figure.pdf}. So there seems to be so much freedom here that it’s hard to control the exact size of the final font, so I have to draw and render repeatedly to achieve an imprecise subjective trade-off, rather than having a uniform font size for all figures in one paper. I guess that’s hardly the right way to do this. So I would like to consult the experienced seniors here, is there a better standardized practice?

Thanks!

2 Likes

With Makie this is rather easy. There was just a thread the other day:

It is also explained in the documentation:

The only thing missing is that you need to set pt_per_unit when saving and not upon creation of the Figure.

2 Likes

Thank you! I’ll have a look. :handshake:

This might not suit everyone, but for optimal control and perfect integration of figures in LaTeX documents, you cannot beat pgfplotsx.jl. It actually generates LaTeX code, so that the figure is compiled and generated by TeX/LaTeX itself.

4 Likes

Interesting. Thanks!

Just as an example. Makie.jl only supports Computer Modern, the default LaTeX font (as far as I can tell), while with PgfPlotsX.jl the figure font will match the font of your document, or in fact use any other typeface/size/weight that LaTeX itself supports. If you use Computer Modern in your document, it might not be a big deal, but if you don’t it’s a big advantage.

Another cool thing, is that if you resize your figure (e.g. by changing the value in \includegraphics[width=0.6\textwidth]), the fonts are not affected.

3 Likes

You can load/use other fonts with Makie:

Sure this is not as automatic as with pgfplots

1 Like

Thanks for the correction. I tried to verify my claim, and found several places saying only Computer Modern was supported, but those must be out of date.

2 Likes

Only Computer Modern is supported for Latex rendering, since MathTexEngine needs some adjustments per font: [FEATURE]? Is there a way to use different fonts in LaTeXStrings? · Issue #53 · Kolaru/MathTeXEngine.jl · GitHub
It should be relatively easy to add more fonts, but nobody has stepped up yet to do that.
Makie itselfs supports any font you throw at it!

6 Likes

I think @kolaru switched to

Currently available are
- NewComputerModern
- TeXGyreHeros

ref

for LaTeX. NewComputerModern has 3000+ glyphs, whereas ComputerModern (ComputerModern/cmmib10.ttf) has 134.

I don’t know what work is involved to support new fonts - if there were instructions … :thinking: :slight_smile:

2 Likes