MATLAB: Problem with errorbars and export_fig

errorbarsexport_figmissing errorbars

Hi everybody, I have come across a strange problem while using export_fig(). It does not seem to export errorbars
x=1:10;
y=x.^2-2*rand(size(x));
err=abs(x.^2-y);
errorbar(x,y,err,'r*')
legend('data'
export_fig(gca,'testing.jpg')
hold on
plot(x,y,'--')
export_fig(gca,'testing2.jpg')
When I try to run this code (or anything with errorbars) export_fig() leaves the errorbars out. In the example code testing.jpg appears to me as a blank set of axis. I noticed that if I use plot() to plot the markers onto the axes export_fig works just fine. Is there something extra I need to add into export _fig to make it work with errorbars?
Cheers
Rhys

Best Answer

Export_fig exports error bars just fine. Try:
x=1:10;
y=x.^2-2*rand(size(x));
err=abs(x.^2-y);
errorbar(x,y,err,'r*')
export_fig(gcf,'testing.jpg')
hold on
plot(x,y,'--')
export_fig(gcf,'testing2.jpg')
Related Question