Greek letters and symbols in stacked plots
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Francesco Cattaneo
le 1 Nov 2020
Commenté : Aman Maskay
le 16 Mar 2021
Hi everyone,
I'm trying to create a stacked plot with the stackedplot() function.
I have the X vector of values and four series of Y values as columns of a matrix. Is it possible to insert tex symbols in y axes labels?
I tried the following lines, but, can't introduce special characters.
X = linspace(0,1,1000);
Y = rand(length(X),4);
txt3 = '\Delta E_{m=3}';
txt4 = '\Delta E_{m=4}';
txt6 = '\Delta E_{m=6}';
txt8 = '\Delta E_{m=8}';
newYlabels = {txt3, txt4, txt6, txt8};
newXlabel = 't [s]';
sss = stackedplot(X,Y,'DisplayLabels',newYlabels,'xlabel',newXlabel);
grid on
Thanks to anyone who wants to help me!
1 commentaire
Walter Roberson
le 1 Nov 2020
There is no documented way to control that. The stackedplot call returns a Stackedplot object which contains a property that allows you to control some of the y-axis properties, but only 4 things can officially be changed.
I am not at my desk so I cannot currently investigate what hidden properties are available.
Réponse acceptée
Walter Roberson
le 4 Nov 2020
If you take
sssax = sss.NodeChildren(end/2+1:end);
then the result is a column vector of the axes that were created to display the objects.
You can then
for K = sssax.'; K.YLabel.Interpreter = 'tex'; end
and the label will change.
3 commentaires
Walter Roberson
le 15 Mar 2021
That's a good question. When I experiment in Livescript, I find that changes I make to the axes after the stack plot do not seem to matter -- I can outright clear the axes and it doesn't change what is already displayed.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Formatting and Annotation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!