Effacer les filtres
Effacer les filtres

Unable to change font image and latex interpreter

9 vues (au cours des 30 derniers jours)
Lieke
Lieke le 8 Jan 2024
Commenté : Lieke le 11 Jan 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 commentaires
Dyuman Joshi
Dyuman Joshi le 8 Jan 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 le 11 Jan 2024
Thank you for you answer. That works!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by