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

1 回表示 (過去 30 日間)
Hydro
Hydro 2017 年 9 月 22 日
コメント済み: Hydro 2017 年 9 月 22 日
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');

採用された回答

the cyclist
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 件のコメント
Hydro
Hydro 2017 年 9 月 22 日
Like this one too. Many thanks

サインインしてコメントする。

その他の回答 (1 件)

Cam Salzberger
Cam Salzberger 2017 年 9 月 22 日
whichVals = x > 0;
plot(x(whichVals), f(whichVals), ...)
-Cam
  4 件のコメント
the cyclist
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.
Hydro
Hydro 2017 年 9 月 22 日
Many thanks to both of you. I ended up using cyclist solution.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxes Appearance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by