Can't save a figure plotted by several 'surfm'-s in vector format

14 ビュー (過去 30 日間)
Aleksey
Aleksey 2023 年 2 月 25 日
コメント済み: Aleksey 2024 年 9 月 2 日
I need to plot a map with a landmask. I use the 'surfm' function:
clf
axesm('MapProjection','polycon',...
'MapLatLimit',[-10 10],'MapLonLimit',[-10 10])
axis off
LAT=-10:.1:10;
LON=-10:.1:10;
Z=LAT'*LON;
surfm(LAT,LON,Z)
colormap jet
print('map','-djpeg')
The result is
Then apply a landmask
land_bit=ones(size(Z));
land_bit(LAT<0,:)=0;
surfm(LAT,LON,zeros(size(Z)),'FaceColor',[.6 .85 1],'FaceAlpha','flat',...
'AlphaDataMapping','none','AlphaData',land_bit)
print('map','-djpeg')
The result is
But when I try to save it in vector format
print('map','-dmeta')
or
print('-painters','map','-dmeta')
I just have
  2 件のコメント
Shlok
Shlok 2024 年 8 月 20 日
Hi Aleksey,
I executed the code you provided in MATLAB R2020a as well as R2024a, and in both cases, I was able to get the correct output for the vector format, as shown below:
The issue you are facing may be due to an incomplete or incorrect MATLAB installation, particularly with components related to graphics. Verifying and repairing the MATLAB installation or upgrading to the latest version could help resolve this issue.
For further information on dealing with low-level graphics issues, you can refer to the following link:
Hope this helps.
Aleksey
Aleksey 2024 年 9 月 2 日
Thank you. It may be a reason.

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

回答 (1 件)

AKennedy
AKennedy 2024 年 8 月 29 日
To resolve the error when exporting a .svg from MATLAB:
  • Switch Renderer: Use opengl instead of painters:
set(gcf, 'Renderer', 'opengl');
exportgraphics(gcf, 'output.svg', 'ContentType', 'vector');
  1 件のコメント
Aleksey
Aleksey 2024 年 9 月 2 日
exportgraphics doesn't work, but opengl does! Thanks!

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

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by