Why funny straight lines contour plots? especially when saving..

8 Ansichten (letzte 30 Tage)
Michael
Michael am 15 Mai 2016
Kommentiert: Tejas am 18 Mai 2016
I get strange lines when trying to save a plot with contour lines (see attached pic). How do I get rid of these straight lines? there are also some before saving depending on my set xlim or contour levels. I have a feeling there might be a setting I can turn on/off to remove this but not sure what it is...
code:
% all matrices are 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
  1 Kommentar
Tejas
Tejas am 18 Mai 2016
Hello Michael, The following information might be helpful in understand your environment:
What release of MATLAB are you using?
What Operating System are you using?
What is the output of the "opengl info" command?
Do you see the issue with the "saveas" command or the "print" command or with both the commands?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by