raacampbell / shadedErrorBar

Produce elegant shaded error bars in MATLAB
GNU Lesser General Public License v3.0
174 stars 70 forks source link

Vector + transparency seems possible #9

Closed jebej closed 7 years ago

jebej commented 7 years ago

It seems using the painters renderer with an alpha value is able to produce a vector graphic, at least on R2015b (my current version). I tested this by changing the commenting out a few lines:

%if transparent
    faceAlpha=patchSaturation;
    patchColor=col;
%    set(gcf,'renderer','openGL')
%else
%    faceAlpha=1;
%    patchColor=col+(1-col)*(1-patchSaturation);
    set(gcf,'renderer','painters')
%end

This allowed me to produce the following PDF file: iv_plot_job_DEBUG_20170804192520.pdf

raacampbell commented 7 years ago

This works for me to on R2017a but only if I export as PDF not if I export as EPS. I guess you were saving as PDF?

jebej commented 7 years ago

Yes. It might be a good idea to use painters with transparency by default (as the MATLAB plot window supports it), and warn that vector output will work with PDF, but not EPS. Then there can be a switch to turn off transparency for EPS vector output.

jebej commented 7 years ago

Transparency by default is a bit nicer as well because it will not hide the ticks.

raacampbell commented 7 years ago

That seems reasonable. See if the latest commit in the dev branch does what you want (it doesn't set the renderer at all any more). It's param/val pairs now for input args after the third.

jebej commented 7 years ago

That looks good! Will saving as EPS without manually switching the renderer disable transparency and save a vector image then?

raacampbell commented 7 years ago

On my system the default renderer seems to be OpenGL, so I would get a transparent-looking raster image by default if I saved as EPS. I felt it was probably better not to silently change the renderer.

raacampbell commented 7 years ago

merged changes into master.