Azzera filtri
Azzera filtri

What is the real size of the fonts in a figure?

11 visualizzazioni (ultimi 30 giorni)
Hongwei Li
Hongwei Li il 12 Giu 2021
Commentato: Hongwei Li il 14 Giu 2021
I set fontsize=12pt when plotting a figure, but it definity NOT 12pt, it is bigger. I have to make sure it is 12pt, because I have to put it in my paper. The code is:
figure; set(gcf,'Position',[100 100 400 400]);
set(gca,'fontsize',12,'fontname','times');
The size of figure is carefully calculated, which should be 400ptx400pt. When I put the figure in word. the fontsize of the figure is bigger than 12pt. How to fix it?
  5 Commenti
Hongwei Li
Hongwei Li il 13 Giu 2021
Modificato: Walter Roberson il 13 Giu 2021
I printed the figure using the code:
exportgraphics(gcf,'F_11.emf','ContentType','vector');
I also tried:
set(gcf,'renderer','Painters'); print -dmeta F_11;
or:
set(gcf,'renderer','Painters'); print -dsvg F_11;
These saved files had same layout and fontsize.
I am not sure about paperposition, but I did set this:
set(gcf,'Position',[100 100 400 400]);
I did not set the paperunits, I thint the default is pixels. I wrote my own function to remove the margins around the figure, I have checked that the size of the printed emf file is 400x400 with no margins, as expected. But when I put the figure in word and set the width as 0.423x400/12=14.1cm, the fontsize in figure is bigger than 12pt, might be 18pt.
That was on my windows computer (win10, 23.8inch, 1920X1080). I also have a a macbook (Big Sur, 15.4inch, 1680x1050), I have installed the lastest Matlab version :2021a update3 on both machine. But the same codes printed different layouts of figure. The fontsizes were too small on macbook. What I want is the fontsize in the figure be consistent with word.
I will try to use centimeter unit later.
Hongwei Li
Hongwei Li il 14 Giu 2021
Problem solved. I used the code:
figure; set(gcf,'Units','centimeter','Position',[5 5 14 14]);
In word, I set the width of the figure as 14cm. Done, the fontsize is exactly 12pt. As I tried, it works when monitor resultion, size change. Macbook and windows pc will print a little different layouts, but the fontsize is exactly 12pt in word.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by