Keeping non-vector elements in a vector graph export
조회 수: 3 (최근 30일)
이전 댓글 표시
I am using Planet3D to generate some plots of transfers around the Solar System. I have figures such as this:
When I export them using
exportgraphics(gca,'name.pdf','ContentType','vector')
I get a pdf file of 90MB that is of course excessive. This is due to the high-resolution surfaces used by the Planet3D function. The alternative is to export it as a non-vector graphic (jpg or png), but I would like to keep the vector nature of the axes and the legend in order to integrate the figure text in my document. I wonder if there might be a way to tell the exportgraphics function to generate the figure with everything as a vector except for the planet objetcs, which can perfectly be rendered in low-resolution and inserted in the resulting pdf.
댓글 수: 0
답변 (1개)
Kartik
2023년 4월 18일
Hi,
You can export the plot as a vector graphic while using low-resolution planet objects by setting the "Renderer" property of the figure to "Painters". This renderer creates vector graphics and is well-suited for simple graphics such as lines, patches, and text, but does not support high-resolution surface rendering.
Here is an example code that demonstrates this approach:
% Generate plot with Planet3D function
figure
p = Planet3D('Earth','Texture','Natural','Clouds',true);
hold on
% Add other plot elements
plot3(...)
% Set Renderer property to Painters
set(gcf,'Renderer','Painters')
% Export plot as PDF with vector graphics
exportgraphics(gca,'name.pdf','ContentType','vector')
For more information on the "Renderer" property and its options, see the MathWorks documentation:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!