how to plot ecdf with > 0 value in a subplot?
Mostrar comentarios más antiguos
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');

Respuesta aceptada
Más respuestas (1)
Cam Salzberger
el 22 de Sept. de 2017
whichVals = x > 0;
plot(x(whichVals), f(whichVals), ...)
-Cam
4 comentarios
the cyclist
el 22 de Sept. de 2017
Editada: the cyclist
el 22 de Sept. de 2017
I think this approach will actually change the cumulative distribution values, and therefore probably not what OP wants.
rng default
N = 1000;
NZ =1000;
t = [rand(N,1); rand(NZ,1)/100];
% Original
figure
ecdf(t)
% Zoom
figure
ecdf(t)
set(gca,'YLim',[0.5 1])
% Logical indexing -- note the ecdf is actually different, so not sure this is OK
figure
ecdf(t(t>0.05))
Hydro
el 22 de Sept. de 2017
the cyclist
el 22 de Sept. de 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
el 22 de Sept. de 2017
Categorías
Más información sobre Exploration and Visualization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!