R2025a exportgraphics new behavior for PDF export
Ältere Kommentare anzeigen
I use to export figure to PDF using the following code :
exportgraphics(fig, [ savepath 'fig_name.pdf'], 'ContentType', 'vector');
It contains both plots and imagesc in subplots.
In Matlab R2024b, the exported PDF would look smooth even zooming in -> vector graphic confirmed. Or good enough let's say: I've heard that imagesc figures can't be vectorized in a proper way anyway.
In Matlab R2025a, the plots are ok, the imagesc are very blured, even if I specify dpi = 600 in the exportgraphic function.
So I'm guessing the behaviour of that function have changed.
Anyone has any input about this ?
How can I have the same result as in R2024b in R2025a is my question.
8 Kommentare
Matt J
am 27 Aug. 2025
We cannot verify what you claim without the figure.
Romain Lance
am 28 Aug. 2025
Bearbeitet: Romain Lance
am 28 Aug. 2025
dpb
am 28 Aug. 2025
"...ust take any randomly generated dat..."
We don't know that it isn't specific to the given figure or machine/system is why...
Submit this to Mathworks as an official support request/bug at <Product Support Page>
Romain Lance
am 28 Aug. 2025
dpb
am 28 Aug. 2025
You didn't provide such information initially, and it's generally simpler/more convenient to provide all needed rather than require the volunteer respondents to create on their own which may or may not actually create the same issues.
I have not installed recent releases because seem to be so many issues so can't check here...somebody with current release may come by.
Just go ahead and submit the bug report/support request...
Romain Lance
am 28 Aug. 2025
I encountered the same problem using 2026a. I attached an example script generated by AI
The pdf I generated has an aliasing line, and does not look sharp when zoomed in. It looks like a compressed raster image. The figure I generated in 2024 did not have this problem.


% 1. Create a synthetic bathymetry dataset (island with a surrounding seabed)
[X, Y] = meshgrid(linspace(-10, 10, 80), linspace(-10, 10, 80));
Z = 1500 * exp(-(X.^2 + Y.^2)/15) - 3000; % Depth from -3000m up to +1500m (island)
lon = X(:);
lat = Y(:);
bathy = [lon, lat, Z(:)];
% 2. Generate quad face connectivity matrix (nv) for the grid
[m, n] = size(X);
[i, j] = meshgrid(1:m-1, 1:n-1);
v1 = (j-1)*m + i;
v2 = j*m + i;
v3 = j*m + i + 1;
v4 = (j-1)*m + i + 1;
nv = [v1(:), v2(:), v3(:), v4(:)];
% 3. Create vector-friendly figure
fig = figure('Units', 'pixels', 'Position', [100, 100, 800, 600]);
ax = axes('Parent', fig);
% Plot bathymetry using your patch snippet
patch('Faces', nv, 'Vertices', [lon lat], ...
'FaceVertexCData', bathy(:, 3), 'FaceColor', 'interp', 'EdgeColor', 'None');
% Standard bathymetry styling
colormap(ax, "parula"); % Or 'parula' / 'turbo' if ocean is unavailable
cb = colorbar(ax);
cb.Label.String = 'Elevation / Depth (m)';
xlabel(ax, 'Longitude (\circ)');
ylabel(ax, 'Latitude (\circ)');
title(ax, 'Synthetic Bathymetry Plot');
axis(ax, 'equal', 'tight');
grid(ax, 'on');
% 4. Export to Vector PDF
% Note: 'ContentType', 'vector' forces vector output rather than a raster image
exportgraphics(fig, 'test_bathymetry_plot.pdf', 'ContentType', 'vector');
disp('Successfully saved vector PDF to bathymetry_plot.pdf');
Edit:
Even generating an eps file and open with GIMP still have the problem
I am using MacOS, M1 chip
Edit2:
I tested on a university HPC server with maltab 2024b and 2025b, and the figures were great. They did not reproduce the same problem. I wonder if it coulde be a rendering problem on my laptop
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Printing and Saving finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!