Insert solar symbol on plot axis
Ältere Kommentare anzeigen
Hello everyone, how can i insert the solar symbol on my plot axis .tried the following and it doesnt work solar = char(9737) ylabel( ['10^{-6} M_',solar, 'Year^{-1}'], 'FontSize',14,'FontWeight','bold'):it gives “?”instead of solar symbol.help
Antworten (1)
KALYAN ACHARJYA
am 21 Jul. 2019
Bearbeitet: KALYAN ACHARJYA
am 21 Jul. 2019
Is this you are looking for?

I tried with your code
solar=char(9737)
ylabel(['10^{-6} M_',solar, 'Year^{-1}'], 'FontSize',14,'FontWeight','bold');
10 Kommentare
charles aouad
am 21 Jul. 2019
Walter Roberson
am 21 Jul. 2019
Is there somewhere in your code that is setting latex interpreter for the labels? Latex interpreter cannot use Unicode characters. Tex interpreter can use Unicode.
charles aouad
am 21 Jul. 2019
Walter Roberson
am 21 Jul. 2019
Could you remind us which MATLAB version are you using?
charles aouad
am 21 Jul. 2019
Walter Roberson
am 21 Jul. 2019
Could you go to the command line and try those two lines,
solar=char(9737)
ylabel(['10^{-6} M_',solar, 'Year^{-1}'], 'FontSize',14,'FontWeight','bold');
just by themselves?
solar = char(9737);
set(get(sub3,'Ylabel'),'String','\Sigma{sfr}/\Sigmasfr_{total} [M ,solar, Kpc^{-2}Year^{-1}]');
Look more closely at that. Your quoted strings are
'Ylabel'
'String'
'\Sigma{sfr}/\Sigmasfr_{total} [M ,solar, Kpc^{-2}Year^{-1}]'
Notice that in that third one, solar is within the quoted string, so it is going to be taken literally rather than the assigned value being used.
['\Sigma{sfr}/\Sigmasfr_{total} [M ,', solar, ',Kpc^{-2}Year^{-1}]']
charles aouad
am 22 Jul. 2019
Walter Roberson
am 23 Jul. 2019
You ovewrite the label of line 76 with the label at line 78, and overwrite the label of line 78 with the label at line 81.
You should probably be recording axes handles and passing them to your various plotting calls.
charles aouad
am 24 Jul. 2019
Walter Roberson
am 24 Jul. 2019
I do not know what sub1 is in this context.
You need to be careful with calling xlabel() or ylabel() just after your subplot() call, in that if you do not do a hold on before you plot() then plot() will probably erase the labels.
I recommend that you read https://www.mathworks.com/support/search_results.html?q=tag%3Aalways-parent
Kategorien
Mehr zu Gravitation, Cosmology & Astrophysics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

