anyway to get list of linestyle in uiaxes of app

2 vues (au cours des 30 derniers jours)
Yu Li
Yu Li le 2 Sep 2019
Modifié(e) : Adam Danz le 5 Sep 2019
Hi:
I have an UIAxes in app and I need the list of line style of it, the command I use is:
lineStyle=app.UIAxes.LineStyleOrder;
the question is that, no matter how much plot I have inside that UIAxex, the result is always '-'. but what I need, is a list of it. for example, I have a regular plot that created in matlab command window:
x=1:10;
y1=x;
y2=x.^2;
y3=x.^3;
plot(x,y1,'-')
hold on
plot(x,y2,'--')
hold on
plot(x,y3,':')
then, I use command:
h = findobj(gca,'Type','line');
lineStyle={h(:).LineStyle}
where 'lineStyle' is what I wanted. is there anyway to get the same result in UIAxes insdie app-deisgner?
Thanks!
Yu
  1 commentaire
dpb
dpb le 3 Sep 2019
Never used the UIAxis so "I know nuthink!" but looks like a crippled subset of regular axes. My suggestion would be to save the line handles when plotting so can query the array of them for their properties.
Or you could try Yair's FEX submission to look for hidden properties in the UIAxes object and see if one of those might contain the information you're looking for.

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 3 Sep 2019
Modifié(e) : Adam Danz le 5 Sep 2019
For an axis or uiaxis, the LineStyleOrder default value is '-' no matter what you've plotted unless that property was changed for the axis or for the graphics root. Matlab cycles through the line styles only after using all the colors contained in the ColorOrder property.
To get a list of line styles that exist in your axes, you can apply your last 2 lines of code to a UIAxes,
h = findobj(app.UIAxes,'Type','line');
lineStyle={h.LineStyle};

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots 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!

Translated by