Drawing Error bars with specific linestyle
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Savio Sciancalepore
le 2 Août 2016
Réponse apportée : dpb
le 2 Août 2016
Hello to everybody, does anyone know a way for drawing errorbars with the same style of the data line?
For example, when using:
d = errorbar(x,y,y_error,'Linestyle', ':');
MATLAB returns the data lines in dotted style, while the bars in each of the points are straight. What if I want also the bars in the dotted style?
0 commentaires
Réponse acceptée
Plus de réponses (1)
dpb
le 2 Août 2016
Set the 'linestyle' property of the second errorbar series object obtained from the hggroup handle returned by errorbar -- from the example
>> X = 0:pi/10:pi;
Y = sin(X);
E = std(Y)*ones(size(X)); % the example data...
>> hE=errorbar(X,Y,E); % save handle this time
>> get(hE,'type') % what is the handle?
ans =
hggroup
>> hEC=get(hE,'children'); % and get the objects
>> get(hEC,'type') % and what are they???
ans =
'line'
'line'
>>
Aha! they're the two lines...take a chance the errorbars are the second; data the first...
>> set(hEC(2),'linestyle',':')
>>
Unfortunately, TMW didn't implement being able to set both 'linestyle' properties from the UI named parameter. If they'd accept a cell array of strings, could apply them to the two objects if present but didn't so you have to set the property separately after locating the proper object handle.
0 commentaires
Voir également
Catégories
En savoir plus sur Errorbars 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!