How can I change the font size of the current axis?
Mostra commenti meno recenti
How can I change the font size of the axes of the current graph without creating new axes? For example, if we have this plot already, how can I change the font size?
x = rand(10,10);
y = rand(10,10);
plot(x,y)
Risposta accettata
Più risposte (2)
Image Analyst
il 16 Mag 2022
1 voto
See attached demo to see how you can independently change a wide variety of things in your axes.

3 Commenti
Rhythm Analyst
il 26 Ott 2022
Modificato: Rhythm Analyst
il 26 Ott 2022
Image Analyst, your file is really helpful.
However, I cannot get it to work when I split y axis into a left and right axis...

The left axis worked fine, only because I did not specify "yyaxis left" before line 54.
Only at line 58 did I introduce having two y axes. I do not know how to use comma-separated list assignments to accomplish changing the font size of the values on the right y axis.
Any help would be appreciated, thank you.
Image Analyst
il 26 Ott 2022
Attach your script and say what you want each y axis to look like (fontsize, color, tickmarks, or whatever).
Rhythm Analyst
il 26 Ott 2022
Solved the issue; I was using ax=gca; for both 'yyaxis left' and 'yyaxis right'. Fix was to have ax1 for left yaxis and ax2 for right yaxis; as far as I can tell thats what fixed it anyway...
Thanks for the response.
There is one minor correction with one of the otptions proposed by @Mat Fig using fontsize() the unit has to be specified:
x = 1:5;
y = randi(5,1,5);
plot(x,y)
fontsize(gca, 15,'points') % 'pixels', 'centimeters', 'inches'
Categorie
Scopri di più su Axes Appearance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
