Saving an image file, text formatting lost.

9 ビュー (過去 30 日間)
Tom Edwards
Tom Edwards 2020 年 11 月 29 日
コメント済み: Rik 2020 年 12 月 2 日
when I'm saving plots I'm losing the formatting I put on my text. Not sure why.
Here's an example
Txtsz = 10;
figure
subplot(1,2,1)
plot(Top20_Densities_final,Top20_Depth_final)
set(gca,'Ydir','reverse')
title('Simulated density profile at final time-step')
xlabel('Density (kg m^{⁻3})')
ylabel('Depth(m)')
subplot(1,2,2)
plot(y_Densities_Final,x_Depths_Final,'o',yi_interpolated_densities_final,xi_interpolated_depths_final)
set(gca,'Ydir','reverse')
title('Interpolated profile')
xlabel('Density (kg m^{⁻3})')
ylabel('Depth (m)')
legend('Interpolated data points','Location','west')
set(findall(gcf,'-property','FontSize'),'FontSize',Txtsz)
saveas(gcf,fullfile(fpath,'Simulated density profile, Top 50m, final timestep & interpolated data'),'png');

採用された回答

Tom Edwards
Tom Edwards 2020 年 12 月 2 日
After trying some different things, this worked best for me. Thanks anyhow Rick
set(0,'defaultfigurepapersize',[29.7 16]);
set(0,'defaultfigurepaperposition',[.25 .25 [29.7 16]-0.5]);
set(0,'DefaultTextInterpreter','none');
set(0, 'DefaultFigureUnits', 'centimeters');
set(0, 'DefaultFigurePosition', [.25 .25 [29.7 16]-0.5]);
  1 件のコメント
Rik
Rik 2020 年 12 月 2 日
You're welcome Tocm

サインインしてコメントする。

その他の回答 (1 件)

Rik
Rik 2020 年 11 月 29 日
There are two renderers in Matlab. Each has their specific use, but the saveas function sometimes switches to the other renderer.
I suggest considering the export_fig function.

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by