Drawing Error bars with specific linestyle
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Savio Sciancalepore
el 2 de Ag. de 2016
Respondida: dpb
el 2 de Ag. de 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 comentarios
Respuesta aceptada
Más respuestas (1)
dpb
el 2 de Ag. de 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 comentarios
Ver también
Categorías
Más información sobre Errorbars en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!