how to plot ecdf with > 0 value in a subplot?

1 view (last 30 days)
Hello all, I am biased correcting climate data. In Figure below subplot (a) and (b) are fine as data is less or greater than zero, however, subplot (c) due to a lot of zero values, the bias correction doesn't appear very clear. Is there anyway, I can plot only data that correspond to values greater > 0. Here is my code and the sample figure
subplot(1,3,1)
[f,x]=ecdf(BMinT_his_EC);
plot(x,f,'r','LineWidth',1)
hold on
[f,x]=ecdf(BMinT_his_RRCM5);
plot(x,f,'k','LineWidth',1)
[f,x]=ecdf(BMinT_his_CRCM5);
plot(x,f,'b','LineWidth',1)
hold off
text(-40,0.95,'$\textcircled{\bf a}$', 'Interpreter', 'latex','color','k','FontSize',20);
axis tight
ylabel('Cumulitive frequency');
xlabel('Temperature (\circC)')
subplot(1,3,2)
[f,x]=ecdf(BMaxT_his_EC);
plot(x,f,'r','LineWidth',1)
hold on
[f,x]=ecdf(BMaxT_his_RRCM5);
plot(x,f,'k','LineWidth',1)
[f,x]=ecdf(BMaxT_his_CRCM5);
plot(x,f,'b','LineWidth',1)
hold off
text(-40,0.95,'$\textcircled{\bf b}$', 'Interpreter', 'latex','color','k','FontSize',20);
axis tight
ylabel('Cumulitive frequency');
xlabel('Temperature (\circC)')
subplot(1,3,3)
[f,x]=ecdf(BPrec_his_EC);
plot(x,f,'r','LineWidth',1)
hold on
[f,x]=ecdf(BPrec_his_RRCM5);
plot(x,f,'k','LineWidth',1)
[f,x]=ecdf(BPrec_his_CRCM5);
plot(x,f,'b','LineWidth',1)
hold off
text(60,0.95,'$\textcircled{\bf c}$', 'Interpreter', 'latex','color','k','FontSize',20);
ylabel('Cumulitive frequency');
xlabel('Precipitation (mm)')
set(gcf,'NextPlot','add');
axes;
set(gca,'Visible','off');
h = title('Bias correction of Regional Climate Modem (RCM) ver 4','fontweight','b','fontSize',16);
set(h,'Visible','on');

Accepted Answer

the cyclist
the cyclist on 22 Sep 2017
You can manipulate the data to get what you want to do, but I think it is easier to just zoom in on the relevant part of the plot. How about just doing
set(gca,'YLim',[0.7 1])

More Answers (1)

Cam Salzberger
Cam Salzberger on 22 Sep 2017
whichVals = x > 0;
plot(x(whichVals), f(whichVals), ...)
-Cam
  4 Comments
the cyclist
the cyclist on 22 Sep 2017
Sorry, I misread Cam's code completely. I thought he was doing the ecdf with the modified BPrec_his_EC values. His approach is perfect.
Hydro
Hydro on 22 Sep 2017
Many thanks to both of you. I ended up using cyclist solution.

Sign in to comment.

Categories

Find more on Axes Appearance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!