5

As noted in the documentation, MATLAB's brush does not work with errorbar plots (see section Plot Types You Cannot Brush). For example,

figure;
errorbar((1:10)+2*sin(.3:.3:3),cos(1:1:10)/2);
hold all;
plot(10:-1:1,'o-g');
brush

generates a plot where I can brush data points from the green plot, but not from the red errorbar plot:

screenshot

Update

Ideally I would like to find a way to retroactively make plots with error bars brushable, short of extracting XData and YData and recreating a graph with plot.

Failing that, is there a function to replace errorbar which allows this for plots I create in the future?

Jonas Heidelberg
  • 4,984
  • 1
  • 27
  • 41

1 Answers1

2

Plot objects created via line are not brushable, but those created via plot are. Since both objects are of type line, I suspect the difference might be on the level of Java.

However, this suggests a workaround: You can write a version of errorbar that uses the line command instead of the plot command to draw the errorbars, thus allowing you to browse just the plot.

Jonas
  • 74,690
  • 10
  • 137
  • 177
  • So you are saying to use `plot` for the data points and `line` for the error bars, in contrast to `errorbar` which presumably uses `line` for both? – Jonas Heidelberg Oct 07 '11 at 10:17
  • @Jonas Heidelberg: This is exactly what I did (plus a bunch of other things). Also, I looked at Matlab's latest `errorbar` function, and I think the solution turns out to be very simple (see edit). – Jonas Oct 07 '11 at 12:00
  • That line of code is not called with my test code, only if `v6` is true. Debugging shows the line objects are actually created inside `specgraph.errorbarseries()`... but I don't see what keeps them from being brushable. – Jonas Heidelberg Oct 07 '11 at 12:43
  • @Jonas Heidelberg: Oops, I missed that. Deleted. – Jonas Oct 07 '11 at 12:57