Filter löschen
Filter löschen

Adjusting the height of mathematical symbols in Matlab

1 Ansicht (letzte 30 Tage)
peter huang
peter huang am 7 Jul. 2023
Kommentiert: Voss am 15 Aug. 2023
In MATLAB, I would like to use mathematical symbols in the legend and adjust the vertical alignment between the symbols.
How can I achieve this?
Here is the code I am currently testing.
I want the two symbols to have equal heights.
clear all ; clc ;clf
set(gcf,'color','w')
%%
x = 1 : 0.01:10
x = 1×901
1.0000 1.0100 1.0200 1.0300 1.0400 1.0500 1.0600 1.0700 1.0800 1.0900 1.1000 1.1100 1.1200 1.1300 1.1400 1.1500 1.1600 1.1700 1.1800 1.1900 1.2000 1.2100 1.2200 1.2300 1.2400 1.2500 1.2600 1.2700 1.2800 1.2900
y = sin(x)
y = 1×901
0.8415 0.8468 0.8521 0.8573 0.8624 0.8674 0.8724 0.8772 0.8820 0.8866 0.8912 0.8957 0.9001 0.9044 0.9086 0.9128 0.9168 0.9208 0.9246 0.9284 0.9320 0.9356 0.9391 0.9425 0.9458 0.9490 0.9521 0.9551 0.9580 0.9608
plot(x,y)
legend('\Sigma\gamma','box','off','fontsize',16)

Antworten (1)

Voss
Voss am 7 Jul. 2023
This may help get you closer to what you want:
clear all ; clc ;clf
set(gcf,'color','w')
%%
x = 1 : 0.01:10
x = 1×901
1.0000 1.0100 1.0200 1.0300 1.0400 1.0500 1.0600 1.0700 1.0800 1.0900 1.1000 1.1100 1.1200 1.1300 1.1400 1.1500 1.1600 1.1700 1.1800 1.1900 1.2000 1.2100 1.2200 1.2300 1.2400 1.2500 1.2600 1.2700 1.2800 1.2900
y = sin(x)
y = 1×901
0.8415 0.8468 0.8521 0.8573 0.8624 0.8674 0.8724 0.8772 0.8820 0.8866 0.8912 0.8957 0.9001 0.9044 0.9086 0.9128 0.9168 0.9208 0.9246 0.9284 0.9320 0.9356 0.9391 0.9425 0.9458 0.9490 0.9521 0.9551 0.9580 0.9608
plot(x,y)
legend('\fontsize{16}\Sigma\fontsize{22}\gamma','box','off','interpreter','tex')

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by