MATLAB: Multiple histograms when overlaid are not transparent in the EPS file generated using “publish” function

MATLABtransparency;eps;latex;publish;print

The bars are not transparent when histograms are published to Latex EPS files. 
I tried to publish the following to latex output format
histogram(randn(1000,1)); 
hold on 
histogram(3*randn(1000,1));
The resulting image in the Latex file lacks transparency. 

Best Answer

This is the limitation of the EPS format. It does not support transparency.
There are two workarounds for this issue:
1) You could publish the file to PDF format instead of Latex to have the transparency effect on the image.
2) You could use “print” command to tell MATLAB to use OpenGL renderer when generating EPS file using the following command:
>> print(gcf, '-opengl','-depsc',EPSOutputfilename)
You can include this EPS image into the Latex file. OpenGL renderer embeds a raster image. It does not support vectorized graphics.