How to save graphs as vector images?
44 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Cool Symbol Fonts
le 27 Déc 2021
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.
Réponses (2)
Richard Quist
le 30 Mar 2015
Modifié(e) : Richard Quist
le 30 Mar 2015
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 commentaires
John Zucker
le 4 Mai 2018
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 commentaires
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!