Filter löschen
Filter löschen

how to write superscripts in axis labels?

282 Ansichten (letzte 30 Tage)
Manikatam Gaddam
Manikatam Gaddam am 10 Dez. 2016
Kommentiert: Adam Danz am 19 Aug. 2019
when I wrote the following plot. I couldn't get the superscript in labels.Can you guys help me. Thank you.
d = [ 2 4 5 7] d5l =1*[0.8839 2.45 13.59 5.492] plot(d,d5l,'--kd','markersize',20,'markerfacecolor','k') str1=' bell diameter $$d $$[cm]' str2='$$|\overline{Q}|$$ [cm^2/s]' legend('x/d = -1') xlabel(str1,'interpreter','latex','fontsize',30,'fontweight','bold') ylabel(str2,'interpreter','latex','fontsize',30,'fontweight','bold') set(gca, 'FontSize', 35,'fontweight','bold'); box on
  2 Kommentare
David Barry
David Barry am 10 Dez. 2016
Please format your code so we can help.
Manikatam Gaddam
Manikatam Gaddam am 10 Dez. 2016
%%can you look on yaxis label
d = [ 2 4 5 7]; d5l =1*[0.8839 2.45 13.59 5.492]; hold on plot(d,d5l,'--k^','markersize',20,'markerfacecolor','k'); str1=' bell diameter $$d $$[cm]'; str2='$$|\overline{Q}|$$ [cm^{2}/s]'; legend('x/d = -1'); xlabel(str1,'interpreter','latex','fontsize',30,'fontweight','bold'); ylabel(str2,'interpreter','latex','fontsize',30,'fontweight','bold');
set(gca, 'FontSize', 35,'fontweight','bold'); box on

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 10 Dez. 2016
To get a subscript you must use the underscore "_" character and for superscript use "^". For example:
plot(1:10)
title('^{super} normal _{sub}')
  2 Kommentare
Manikatam Gaddam
Manikatam Gaddam am 10 Dez. 2016
Bearbeitet: KSSV am 16 Apr. 2018
%%can you look on yaxis label
d = [ 2 4 5 7];
d5l =1*[0.8839 2.45 13.59 5.492];
hold on
plot(d,d5l,'--k^','markersize',20,'markerfacecolor','k');
str1=' bell diameter $$d $$[cm]';
str2='$$|\overline{Q}|$$ [cm^{2}/s]';
legend('x/d = -1');
xlabel(str1,'interpreter','latex','fontsize',30,'fontweight','bold');
ylabel(str2,'interpreter','latex','fontsize',30,'fontweight','bold');
set(gca, 'FontSize', 35,'fontweight','bold');
box on
Adam Danz
Adam Danz am 19 Aug. 2019
str2='$$|\overline{Q}|$$ [cm^{2}/s]';
% should be
str2='$$|\overline{Q}| [cm^{2}/s]$$';

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by