When using MATLAB, 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 solid lines. How do I make the bars also be a dotted line?
You can use the undocumented
Barproperty of theErrorBarobject to set the line style:Or if you just want it to be the same as the
LineStyleyou specified you could also use the undocumentedLineproperty:For future reference, you can get a list of all properties and methods for a graphics object (undocumented or not) by obtaining the
meta.classfor the object:You can often find and modify the various pieces of a complex plot object using undocumented properties found in this way.