Axis exponent missing when using exportgraphics to export figure in pdf vector format (or image)
古いコメントを表示
Hi,
When I use exportgraphics to export a figure in pdf vector graphics format (or even image formats such as .png, .tiff), any axis exponents from the figure are missing in the output export file. For my application, I need to export the figure in vector format.
Example code to generate figure:
fig1 = figure(1);
plot(rand(10,1)*10^-5)
exportgraphics(fig1,'testMissingAxisExponent01.pdf','ContentType','vector');
Example figure exported by using 'Save As' in MATLAB figure GUI (which properly shows the axis exponent):

Example figure generated from exportgraphics (with the missing axis exponent):

I first discovered this issue when working with plots in nested tiles using tiledlayouts and tried increasing the padding with no success. However, this issue seems to be related to exportgraphics.
Any solutions or workarounds? Thank you!
2 件のコメント
Jim Shell
2024 年 4 月 5 日
Same issue here......
Matt Latourette
2024 年 6 月 12 日
I was using the export button from the axes toolbar instead of calling exportgraphics programmatically, but I encounter the same problem with the exponent for the y-axis being cut off when I try to save a plot. I'm using MATLAB R2024a.
After I found this question on the MATLAB Answers web page, I took a look at the documentation for the exportgraphics command. The "Padding" option seemed promising as a potential solution, but when I tried that I got an error message stating, "Illegal option 'padding' given." What I tried, specifically, was to click on the plot axes to select my plot. Then, in the command window:
ax = gca;
exportgraphics(ax, "figurepadding.png", "Padding", "figure")
採用された回答
その他の回答 (1 件)
Pablo Nicolas
2024 年 3 月 27 日
移動済み: Fangjun Jiang
2024 年 3 月 27 日
1 投票
I encountered the same problem and I was looking for an answer or possible solution but unsucessfully. What I did that finally solved the issue was to install an older Matlab version (Matlab 2023a). Hopefully, this was helphul for you!
2 件のコメント
Raymond Yeung
2024 年 3 月 27 日
移動済み: Fangjun Jiang
2024 年 3 月 27 日
Raymond Yeung
2024 年 3 月 27 日
カテゴリ
ヘルプ センター および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!