How to save graphs as vector images?
조회 수: 41 (최근 30일)
이전 댓글 표시
How do I save graphs as vector images and with custom image size? Right now I'm using print("gcf",-dpdf, "...") but I'm hoping there's a better function because I'm forced to create 8.5"x11" size images. The file format isn't important as long as it's a vector image format.
Thank you.
댓글 수: 1
Cool Symbol Fonts
2021년 12월 27일
Highlights Logo Maker includes dozens of attractive layouts as well as other editing options for creating professional designs such as highlight cover, reel covers, logos, etc. Our Cover maker app lets you create eye-catching Instagram highlight covers to improve your IG profile.
답변 (2개)
Richard Quist
2015년 3월 30일
편집: Richard Quist
2015년 3월 30일
The output size is controlled by the figure's PaperPosition property. PaperPosition is a 4 element vector that specifies an x- and y-offset (used only by "paged" formats like PDF, PostScript, and printing to paper), and a width and height. The units it uses is specified in the figure's PaperUnits property.
For example, if you want the figure to be 2" by 2" in the PDF file you would do something like this (specifying the width and height to use):
f = figure;
plot(rand(4))
% Specify that the image in the PDF should be 2x2
% My PaperUnits is inches
f.PaperPosition(3:4) = [2 2];
print -dpdf foo.pdf
With the above code the 2x2 image is placed on a full size page (8.5" x 11" for me). If you wanted the PDF to be sized so it was just big enough to hold the image, change the figure's PaperSize property to match the output size, and change the x- and y-offsets of the PaperPosition property to 0. Continuing the example from above:
% Make the "page" just big enough to hold the size output I want
f.PaperSize = [2 2];
% Specify that we start at the lower-left corner of the page
f.PaperPosition(1:2) = [0 0];
print -dpdf foo2.pdf
Because my PaperUnits are 'inches', this will put my plot onto a PDF file with a "page" that is 2" x 2".
See the the print command documentation: for more information on figure properties that affect printing/exporting.
Hope that helps.
댓글 수: 0
John Zucker
2018년 5월 4일
About customize size, do you mean by its dimension? If so, I know an simpler online app - DesignEvo that has vector and raster support but requires you to draw the graphics within the app.
Otherwise, if you mean the attribute size, I don't think there is a way to control the size. It's defined by the math and the software.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!