Matlab figures: print Vector graphic cointaining image data

2 views (last 30 days)
Dear all, i need to figure out how to create vectorgraphics in a meaningfol way. for example, this snippet produces a nice vector graphic with a 50x50 image:
function VectorGraphicTest
fig=figure(1);clf;
set(fig,...
'renderer','painter')
k=50;
data =rand(k);
range=1:k;
[xx,yy]=ndgrid(range,range);
zz=zeros(size(xx));
surf(xx,yy,zz,data,'EdgeColor','none')
print('TestVecIMage.pdf','-dpdf')
open('TestVecIMage.pdf')
end
however, tfor larger images (640*1024) the 'painters' flag takes minues to print the figure, and Adobe has a hard time showing the images.
now my question is, how can i still print a decen quality vector graph that looks like
but is a vector plot (the pdf print of that last figure is a bitmap) This is for volume data vizualisation, generated with the following code:
function VectorGraphicTest
fig=figure(1);clf;
set(fig,...
'renderer','opengl')
k=1000;
data =rand(k);
range=1:k;
[xx,yy]=ndgrid(range,range);
zz=zeros(size(xx));1
surf(xx,yy,zz,data,'EdgeColor','none')
hold on
surf(xx,yy,zz+1000,data,'EdgeColor','none')
surf(xx,yy,zz+500,data,'EdgeColor','none')
print('TestVecIMage.pdf','-dpdf')
print('TestVecIMage.png','-dpng')
open('TestVecIMage.pdf')
end

Accepted Answer

Jan
Jan on 6 Mar 2018
Processing 650 thousand patch objects needs time. Creating and interpreting vector graphics with a huge number of elements stored in a PDF is expensive such that buying a faster computer is the best option to accelerate it.
There are better formats for such data. I'd expect e.g. a SVG to be faster, see e.g. https://www.mathworks.com/matlabcentral/fileexchange/7401-scalable-vector-graphics--svg--export-of-figures or print -dsvg in modern Matlab versions. But it is not clear if you do need a PDF file.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!