Creting EPS file takes so much time

7 views (last 30 days)
JAY PATEL
JAY PATEL on 28 Dec 2023
Answered: Dinesh on 29 Dec 2023
I have attached the matlab figure. I have used following commands as well as "save as" option in the window.
exportgraphics(gcf,'myVectorFile.eps','BackgroundColor','none','ContentType','vector')
saveas(figure(1), 'Fig.eps', 'epsc')
It takes more than 5-6 hours or may be even more (I couldn't create one yet, it shows that it is in the process). MATLAB gets hanged.
Same goes for svg. svg can't be made either.
Without "painters" the figure looks very bad with very low resolution. I have given link to the matlab figure of my drive since it is 16 mb file.
https://drive.google.com/file/d/13YVgVgTZ2xlR-C2ofqlGMpGNdQvsbOVC/view?usp=drive_link

Answers (1)

Dinesh
Dinesh on 29 Dec 2023
Hi Jay,
The figure appears to be a dense contour plot or a heatmap with a high number of data points. Such plots can be very resource-intensive to render as vector graphics. This is because vector graphics are rendered based on paths, which are defined by mathematical equations. A dense plot with many data points requires a large number of paths to be calculated and drawn. Each data point or line segment in the plot translates to a path in vector graphics. When there are thousands or millions of these, the file becomes very complex, making rendering, processing, and exporting very time consuming.
To render it faster, the complexity of the image needs to be reduced if you want to export everything as a vector.
You could also try approaches to rasterize some parts while keeping the other parts as vectors to speed up the rendering process, but as far as I know, MATLAB doesn't inherently support it. You might need to export the vector content and raster content separately after which you can combine them.
The following MATLAB File Exchange contribution might also help you:

Categories

Find more on Printing and Saving in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!