Commit efcc1f93 authored by Tom Marshall's avatar Tom Marshall

changed the order figures are plotted and tweaked line parameters

parent d0b82399
......@@ -3,7 +3,7 @@ function h = raincloud_plot(X,cl)
[a,b] = ksdensity(X);
wdth = 0.8; % width of boxplot
% TODO, should probably be some percentage of max.height of kernel density plot
% TODO, should probably be some percentage of max height of kernel density plot
% density plot
h{1} = area(b,a); hold on
......@@ -21,24 +21,26 @@ jit = (rand(size(X)) - 0.5) * wdth;
% info for making boxplot
Y = quantile(X,[0.25 0.75 0.5 0.02 0.98]);
% raindrops
h{2} = scatter(X,jit - 1);
h{2}.SizeData = 5;
h{2}.MarkerFaceColor = cl;
h{2}.MarkerEdgeColor = 'none';
% 'box' of 'boxplot'
h{2} = rectangle('Position',[Y(1) -1-(wdth*0.5) Y(2)-Y(1) wdth]);
set(h{2},'EdgeColor','k')
set(h{2},'LineWidth',2);
h{3} = rectangle('Position',[Y(1) -1-(wdth*0.5) Y(2)-Y(1) wdth]);
set(h{3},'EdgeColor','k')
set(h{3},'LineWidth',2);
% could also set 'FaceColor' here as Micah does, but I prefer without
% mean line
h{3} = line([Y(3) Y(3)],[-1.2 -0.8],'col','k','LineWidth',2);
h{4} = line([Y(3) Y(3)],[-1-(wdth*0.5) -1+(wdth*0.5)],'col','k','LineWidth',2);
% whiskers
h{4} = line([Y(2) Y(5)], [-1 -1],'col','k','LineWidth',2);
h{5} = line([Y(1) Y(4)],[-1 -1],'col','k','LineWidth',2);
h{5} = line([Y(2) Y(5)], [-1 -1],'col','k','LineWidth',2);
h{6} = line([Y(1) Y(4)],[-1 -1],'col','k','LineWidth',2);
% raindrops
h{3} = scatter(X,jit - 1);
h{3}.SizeData = 5;
h{3}.MarkerFaceColor = cl;
h{3}.MarkerEdgeColor = 'none';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment