Azzera filtri
Azzera filtri

Unable to change font image and latex interpreter

9 visualizzazioni (ultimi 30 giorni)
Lieke
Lieke il 8 Gen 2024
Commentato: Lieke il 11 Gen 2024
I'm new at learing matlab and I can't seem to change the font of an image.
I'm usig the following code:
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C);
ylabel('Scan Number', 'Interpreter', 'latex', 'FontName', 'Times New Roman');
xlabel('Q ($\rm{\AA}^{-1}$)', 'Interpreter', 'latex', 'FontName', 'Times New Roman');
set(gca, 'Fontsize', 12, 'FontName', 'Times New Roman');
get(gca, 'fontname')
ans = 'Times New Roman'
The get gca give me the correct font however it doesn't seem to change in the figure. The font also does not seem to change when I change it in the latex interpreter. However I am able to chage the fontsize I want to plot the symbol angstrom ^-1 in the xlabel that is why I'm using the late interpreter. I don't really mind what font it is in but now the fonts are differerent in labels and the ticks numbers and legend. I would like it to be the same font. I would appreciate any insights for either of these issues!
  2 Commenti
Dyuman Joshi
Dyuman Joshi il 8 Gen 2024
I don't think fonts are supported in Latex Interpreter in MATLAB. If you want to implement that, you will have to write code for that, which will be a daunting task.
As for the matching of axis labels and tick labels, you can change the Tick label interpreter to latex as well -
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C);
ylabel('Scan Number', 'Interpreter', 'latex')
xlabel('Q ($\rm{\AA}^{-1}$)', 'Interpreter', 'latex')
set(gca, 'Fontsize', 15, 'TickLabelInterpreter', 'latex');
Lieke
Lieke il 11 Gen 2024
Thank you for you answer. That works!

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Data Import and Export in Help Center e File Exchange

Tag

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by