Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

correlplot.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. function [Rho, Pv, ll, tt]=correlplot(Xmat,dot_col,xlims,ylims)
  2. if nargin <4
  3. ylims=[];
  4. if nargin<3
  5. xlims=[];
  6. if nargin<2
  7. dot_col=[0 0 0];
  8. end
  9. end
  10. end
  11. if size(Xmat,2)==2 && size(Xmat,1)==2
  12. Xmat=Xmat';
  13. elseif all(size(Xmat)~=2)
  14. error('The input matrix has to be of size 2 along at least one dimension');
  15. end
  16. [Rho,Pv] = corrcoef(Xmat);
  17. plot(Xmat(:,1), Xmat(:,2),'o','color',dot_col,'markerfacecolor',dot_col,'markersize',.5); hold on
  18. %[ zq, xq ] = nanmeanquantized( [-.005:.01:1.005], Xmat(:,1), Xmat(:,2) );
  19. %plot(xq,xq,'o','color',dot_col,'markerfacecolor',dot_col,'markersize',2); hold on
  20. if isempty(ylims) || isempty(xlims)
  21. if all(Xmat>0)
  22. ylim([ 0 1].*max(abs(Xmat(:)))); xlim([ 0 1].*max(abs(Xmat(:))));
  23. else
  24. ylim([-1 1].*max(abs(Xmat(:)))); xlim([-1 1].*max(abs(Xmat(:))));
  25. end
  26. else
  27. ylim(ylims); xlim(xlims);
  28. end
  29. ll=lsline(); gch=gca; daspect([1 1 1]);
  30. tt=text(mean(gch.XLim),max(gch.YLim).*.85,[sprintf('\\rho=%2.2f',Rho(1,2)) getpstars(Pv(1,2))]);
  31. if Pv(1,2)<0.05
  32. if Rho(1,2)<0
  33. ll.Color=[1 0 0];
  34. tt.Color=[1 0 0];
  35. else
  36. ll.Color=[0 0 1];
  37. tt.Color=[0 0 1];
  38. end
  39. end
  40. if isempty(ylims) || isempty(xlims)
  41. if all(Xmat>0)
  42. ylim([ 0 1].*max(abs(Xmat(:)))); xlim([ 0 1].*max(abs(Xmat(:))));
  43. else
  44. ylim([-1 1].*max(abs(Xmat(:)))); xlim([-1 1].*max(abs(Xmat(:))));
  45. end
  46. else
  47. ylim(ylims); xlim(xlims);
  48. end
  49. end