MATLAB: Getting transparency in a vector plot

areaepsfacealphaMATLABplottransparencyvector

Hi,
The following creates a plot that uses transparency to render otherwise obscured data visible …
tval = 1980:1:2009;
figure(1); clf;
hold on;
h1 = area(x, y1); set(h1, 'FaceColor', [0.9 0.8 0.8], 'EdgeColor', [0.9 0.8 0.8]); h1b = get(h1, 'Children'); set(h1b, 'FaceAlpha', 0.5);
h2 = area(x, y2); set(h2, 'FaceColor', [0.8 0.8 0.9], 'EdgeColor', [0.8 0.8 0.9]); h2b = get(h2, 'Children'); set(h2b, 'FaceAlpha', 0.5); plot (tval, ann_data_sst, 'r-', tval, ann_nemo_sst, 'b-'); axis ([1980 2009 17.8 19.4]); axis square; xlabel ('Time [year]'); ylabel ('SST [{\circ}C]'); title ('Sea surface temperature');
paper; orient portrait;
print -depsc2 -painters future_1980_2009_phys
… And I'm quite pleased with the result, at least as it appears on the screen. However, when I try to print it to an EPS file, all I get is a flat plot with no transparency. Obscured data remains annoyingly obscured.
From poking around the MathWorks website, it looks like this loss of transparency may be a fundamental limitation of printing to EPS in vector format. If I drop the -painters option or use OpenGL instead (while still writing to an EPS file), I get the transparency but with hideous bitmap fonts, etc. A colleague suggested switching to PDF, but I find I get the same results with this – so long as I'm printing in vector format, transparency seems a no-go.
Has anyone here ever done anything like this successfully (or better) before? Alternatively, does anyone have any tips for how I could plot such a set of data to achieve something like the transparency effect that I'm aiming for?
Apologies for having such a woolly question.
Best regards,
Andrew.
P.S. I can try to post up images of what I mean if it's not obvious.
P.P.S. For reference …
-------------------------------------------------------------------------------------
MATLAB Version 7.8.0.347 (R2009a)
MATLAB License Number: ••••••
Operating System: Linux 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64
Java VM Version: Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.8 (R2009a)
Image Processing Toolbox Version 6.3 (R2009a)
MATLAB Compiler Version 4.10 (R2009a)
M_Map - mapping toolbox (Author: rich@eos.ubc.ca) Version 1.4c 9
Mapping Toolbox Version 2.7.2 (R2009a)
Neural Network Toolbox Version 6.0.2 (R2009a)
Optimization Toolbox Version 4.2 (R2009a)
Partial Differential Equation Toolbox Version 1.0.14 (R2009a)
Signal Processing Toolbox Version 6.11 (R2009a)
Simulink 3D Animation Version 5.0 (R2009a)
Spline Toolbox Version 3.3.6 (R2009a)
Statistics Toolbox Version 7.1 (R2009a)
Symbolic Math Toolbox Version 5.2 (R2009a)
Wavelet Toolbox Version 4.4 (R2009a)

Best Answer

Transparency requires the OpenGL renderer. The OpenGL renderer can export bitmap images only. This is a fundamental limitation.
FEX: ExportSVG might be a workaround.