Commit 7a0be7e7 authored by Tom Marshall's avatar Tom Marshall

added info

parent efcc1f93
function h = raincloud_plot(X,cl)
%% raincloud_plot - plots a combination of half-violin, boxplot, and raw
% datapoints (1d scatter).
% Use as h = raincloud_plot(X, cl), where X is a data vector and cl is an
% RGB value. h is a cell array of handles for the various figure parts.
% Based on https://micahallen.org/2018/03/15/introducing-raincloud-plots/
% Inspired by https://m.xkcd.com/1967/
[a,b] = ksdensity(X);
function h = raincloud_plot(X, cl)
wdth = 0.8; % width of boxplot
% calculate kernel density
[f, Xi] = ksdensity(X);
% width of boxplot
wdth = 0.8;
% TODO, should probably be some percentage of max height of kernel density plot
% density plot
h{1} = area(b,a); hold on
h{1} = area(Xi, f); hold on
set(h{1}, 'FaceColor', cl);
set(h{1}, 'EdgeColor', [0.1 0.1 0.1]);
set(h{1}, 'LineWidth', 2);
......
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