I am creating surface plots with a transparent figure background in Matlab R2015b. Consider the code
n=49;
h=figure;
[x,y]=meshgrid(1:n,1:n);
surf(x,y,peaks(n),'EdgeColor','none')
set(h,'Color','none')
set(h, 'InvertHardCopy', 'off');
print(h,'-dpdf','peaks.pdf')
which gives me a pdf file peaks.pdf
where the axes background is white, but the figure background transparent.
However, if I set n=1000
, the background is no longer transparent, but black (as the figure is displayed in Matlab).
Does anyone know, what the issue is, and how to prevent this? Thanks!