1

尝试使用等高线保存绘图时出现奇怪的线条(见附图)。如何摆脱这些直线?根据我设置的 xlim 或轮廓级别,在保存之前还有一些。我感觉可能有一个设置我可以打开/关闭以删除它,但不确定它是什么......

附加图片

代码:

% 所有矩阵都是 500x93;

% Create axes
axes('Parent',gcf,...
    'Position',[0.130555555555556 0.0685483870967742 0.791666666666667 0.157258064516129]);

contourf(xi_S(1:500,1:93).*Mask_bin_S(1:500,1:93),yi_S(1:500,1:93).*Mask_bin_S(1:500,1:93),...
    zi_S(1:500,1:93).*Mask_bin_S(1:500,1:93),...
    15,'LineStyle','none','Clipping','on')

hold on

contour(xi_S(1:500,1:93).*Mask_bin_S,yi_S(1:500,1:93).*Mask_bin_S,zi_S(1:500,1:93).*Mask_bin_S,...
    37.8:0.2:38.6,'k','ShowText','On','Clipping','on') 
% set contours to be certain intervals, not same as contourf

colormap(gca,flipud(cbrewer('div', 'RdYlBu', 100))); % colormap set
colorbar('peer',gca,'Position',...
    [0.9320074833252 0.0698924731182796 0.0193814055636889 0.387096774193549]);
set(gca,'ydir','reverse','FontSize',16,...
    'XTickLabel',['';'';'';'';'';'';'';'';'';'';'';'';'';''],...
    'XTick',[735761 735762 735763 735764 735765 735766 735767 735768 735769 735770 735771 735772 735773 735774]);
% xlabel('time [days]');
ylabel('axis');
ylim([100 1000])
caxis([37.8 38.7])
xlim([7.357619044019791e+05 7.3577325e+05]);

fname = 'saving/location/'
set(gcf,'PaperUnits','centimeters','PaperPosition',[0 0 30 20])
print('-dpng', 'text.png, -r300');
saveas(gcf,fullfile(fname,['nameoffile']), 'png') %Save figure
4

0 回答 0