Effacer les filtres
Effacer les filtres

Why can't I edit y label and x labels in matlab subplot figures (.FIG)

12 vues (au cours des 30 derniers jours)
Stephen Tete
Stephen Tete le 21 Sep 2023
Commenté : Star Strider le 22 Sep 2023
I have a 3 x 2 subplots (tiledlayout) with a common Y label and X label. I want to edit the labels and change the font and fontsize size but I'm unable to edit it.
The subplots axis labels were controlled by
tle = tiledlayout(3,2,"TileSpacing","compact");
tle.XLabel.String = 'Time';
tle.YLabel.String = 'Temp';
So its a single Y and X labels for the plots.this was done sometime ago and I need to edit the figs to change the fonts and fontsize. The problem does not affect figures with only one plot except for the subplots and tiledlayout figures.

Réponse acceptée

Star Strider
Star Strider le 21 Sep 2023
I’m not certain what the problem is.
You can get the handles to each subplot with:
Axsp = subplot(3,2,4); % Fourth Subplot Axes
for that particular subplot.
You then have access to that subplot’s properties:
Axsp.XLabel = 'NewLabel'
Axsp.XLabel.FontSize = 12;
Example —
figure
subplot(3,2,4)
plot((0:0.1:2*pi), sin((0:0.1:2*pi)))
xlabel('Time (s)')
ylabel('Velocity (cm/s)')
Then later —
Axsp = subplot(3,2,4); % Fourth Subplot Axes
Axsp.XLabel.FontSize = 12;
.
  4 commentaires
Stephen Tete
Stephen Tete le 22 Sep 2023
The last answer works, thank you
Star Strider
Star Strider le 22 Sep 2023
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by