Clear Filters
Clear Filters

Unable to change font image and latex interpreter

9 views (last 30 days)
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 Comments
Dyuman Joshi
Dyuman Joshi on 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');

Sign in to comment.

Answers (0)

Categories

Find more on Data Import and Export in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!