Saving a massive graphics object as mixed vector and image file

17 vues (au cours des 30 derniers jours)
DLR
DLR le 10 Mai 2023
I am trying to save a publication quality version of a very large graphics object (a [19290x1566] spectrogram plotted on loglog axes using surf). I need the text to be in editable vector format per journal requirements, but every approach I can find that theoretically should save a vector image file (and successfully does with a smaller figure) ends up crashing both Matlab and my computer.
I'm noting some details of what I've tried in terms of saving a vector file below for reference, but the only solution I've managed to come up with is to first save the figure as an eps image file and crop it to just the image portion in Adobe Illustrator, then manually delete the surface object and save the empty axes as a vector eps file... then put the two back together in Illustrator. This seems like a right silly solution but I can't find anything better.
Is there any way of saving figures as vector files that preserve axes and text but with the image portion saved as a single raster raster object?
For reference, I'm using Matlab 2023a (but have run into the same problem since at least 2015) and have tried using a range of options with the print function:
print(gcf,'test', '-depsc', '-vector')
I've also tried '-dpdf' and '-dsvg' both with and without the '-vector' option, as well as more complicated approaches like variants of the recommendations provided in both of the following articles/answers:

Réponses (1)

Rasmita
Rasmita le 6 Juin 2023
Hi Danica,
It is my understanding that, you want to save the large figure as a vector file that preserves the axes and text, while exporting the image portion as a raster object.
For this you can use the "export_fig" function available on the MATLAB File Exchange. This function is especially suited to exporting figures for use in publications and presentations.
Here are the steps you can follow to export your figure as a vector file with only the image portion saved as a raster object:
  1. Install the "export_fig" function from the MATLAB File Exchange by downloading the package from the below mentioned: https://www.mathworks.com/matlabcentral/fileexchange/23629-export_fig
  2. Add this folder to your path.
  3. Create and configure your figure.
  4. Configure the "export_fig" options for your export as follows:
export_fig('myfigure.pdf','-pdf','-transparent','-r300','-nocrop');
Please refer to the below link for more information on “export_fig”:
You can also refer to below MATLAB Answer to know more on using export_fig” function:
Hope this helps you resolve the query!
  1 commentaire
Breno Vincenzo de Almeida
Breno Vincenzo de Almeida le 15 Fév 2024
This exports everything in vector format, it doesn't rasterize the image within the axes, while keeping the rest vectorized, as requested in the original post.
exportgraphics does the same.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by