Drawing Error bars with specific linestyle
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Savio Sciancalepore
am 2 Aug. 2016
Beantwortet: dpb
am 2 Aug. 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 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
dpb
am 2 Aug. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Errorbars finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!