MATLAB Answers

add single isolines to contour plot (contourf)

21 views (last 30 days)
Heidi Hirsh
Heidi Hirsh on 16 Dec 2019
I am trying to make contour plots for chemistry data. To simplify the plots I have removed the contour lines but I would like to add contour lines to they 2nd and 5ft subplots at 1000 and 1 respectively. I when I try to add single isolines all the rest of the data goes away (see 'contourf_attempt_singlelines.png'). Any idea what is going on? I haven't tried this kind of plot before. This is how I'm writing it:
f2=figure(2)
ax(1) = subplot(5,1,1)
contourf(MX,mabs,PK.fixPH(2:8,:),'LineStyle','none');
shading('flat');
ylabel('mab','fontsize',16);
c=colorbar; colormap(jet)
title(c,'pH','fontsize',16);
set(gca,'fontsize',16);
x = datenum('July-9-2018'):7:datenum('Oct-3-2018');
set(gca, 'XTick', x);
datetick('x','mm/dd','keepticks')
ax(2) = subplot(5,1,2)
%contourf(MX,mabs,fixPCO2,'LineStyle','none');
contourf(MX,mabs,fixPCO2,[1000 1000])
shading('flat');
ylabel('mab','fontsize',16);
c=colorbar; colormap(jet)
title(c,'pCO2','fontsize',16);
set(gca,'fontsize',16);
x = datenum('July-9-2018'):7:datenum('Oct-3-2018');
set(gca, 'XTick', x);
datetick('x','mm/dd','keepticks')
ax(3) = subplot(5,1,3)
contourf(MX,mabs,fixDIC,'LineStyle', 'none');
shading('flat');
ylabel('mab','fontsize',16);
c=colorbar; colormap(jet)
title(c,'DIC','fontsize',16);
set(gca,'fontsize',16);
x = datenum('July-9-2018'):7:datenum('Oct-3-2018');
set(gca, 'XTick', x);
datetick('x','mm/dd','keepticks')
ax(4) = subplot(5,1,4)
contourf(MX,mabs,fixTA,'LineStyle', 'none');
shading('flat');
ylabel('mab','fontsize',16);
c=colorbar; colormap(jet)
title(c,'TA','fontsize',16);
set(gca,'fontsize',16);
x = datenum('July-9-2018'):7:datenum('Oct-3-2018');
set(gca, 'XTick', x);
datetick('x','mm/dd','keepticks')
ax(5) = subplot(5,1,5)
%contourf(MX,mabs,fixOMEGA,'LineStyle','none');
contourf(MX,mabs,fixOMEGA,[1 1]);
shading('flat');
ylabel('mab','fontsize',16);
c=colorbar; colormap(jet)
title(c,'\Omega_A_r','fontsize',16);
set(gca,'fontsize',16);
x = datenum('July-9-2018'):7:datenum('Oct-3-2018');
set(gca, 'XTick', x);
datetick('x','mm/dd','keepticks')
linkaxes(ax,'x')

Answers (0)

Community Treasure Hunt

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

Start Hunting!