how to plot ecdf with > 0 value in a subplot?
1 次查看(过去 30 天)
显示 更早的评论
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');
0 个评论
采纳的回答
the cyclist
2017-9-22
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])
更多回答(1 个)
Cam Salzberger
2017-9-22
whichVals = x > 0;
plot(x(whichVals), f(whichVals), ...)
-Cam
4 个评论
the cyclist
2017-9-22
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axes Appearance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!