Matlab figures: print Vector graphic cointaining image data
1 view (last 30 days)
Show older comments
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171008/image.png)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171009/image.png)
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
0 Comments
Accepted Answer
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.
0 Comments
More Answers (0)
See Also
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!