Insert solar symbol on plot axis

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

Risposte (1)

KALYAN ACHARJYA
KALYAN ACHARJYA il 21 Lug 2019
Modificato: KALYAN ACHARJYA il 21 Lug 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 Commenti

thank you for your prompt answermy code is exactly as follows, it doesnt work for me :( :
set(get(sub1,'Ylabel'),'String','Rotation velocity [km/s]');
set(get(sub2,'Ylabel'),'String','[km/s/Kpc]');
solar = char(9737);
set(get(sub3,'Ylabel'),'String','\Sigma{sfr}/\Sigmasfr_{total} [M ,solar, Kpc^{-2}Year^{-1}]');
set(get(sub3,'Xlabel'),'String','Galactocentric Radius [Kpc]');
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.
thank you walter. no there is nowhere in my code that sets latex as interpreter for the labels can you show me how to do that? ?in that case i can just use the usual \odot ?
thank you in advance
Could you remind us which MATLAB version are you using?
2018a
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}]']
hi walter, thank you for your reply
i tried what you suggested and the solar symbol shows now but i have another problem
the y labels on subplot 1 and 2 are not showing (line code 76 and 78)
i have attached below a screen shot of my code and the plot generated, i dont know why it refuses to show the y labels for the first 2 subplots while it shows it for the last subplot, am i missing something obvious?screen shot 1 matlab code.jpg
screen shot 1 matlab code.jpg
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.
thank you very much walter for your help.
is there any way where i can specify that this label will gof or this sub plot without the handles?
like when i create the subplot i can immdiately label the axes?
why the command set('sub1','ylabel','velocity in km/s') doesnt work?
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.

Accedi per commentare.

Categorie

Scopri di più su Gravitation, Cosmology & Astrophysics in Centro assistenza e File Exchange

Richiesto:

il 21 Lug 2019

Commentato:

il 24 Lug 2019

Community Treasure Hunt

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

Start Hunting!

Translated by