Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
public
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tom Marshall
public
Commits
4f549eb3
Commit
4f549eb3
authored
Jun 04, 2019
by
Tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update rm_raincloud.m
parent
8049eebd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
raincloud_plots/rm_raincloud.m
raincloud_plots/rm_raincloud.m
+15
-12
No files found.
raincloud_plots/rm_raincloud.m
View file @
4f549eb3
%% Raincloud lineplot for repeated-measures data
% it might be that 'patch' is a much better plotting function to plot the
% densities than 'area'; it seems to handle over-plotting of different
% areas with different zero lines very well. This would avoid the horrible
% gymnastics that the repeated measures raincloudplot currently has to deal
% with.
% This is a work-in-progress example inspired by this post on Matlab
% answers https://uk.mathworks.com/matlabcentral/answers/1387-area-plot-with-gradient
% Use like: h = rm_raincloud(data, colours)
% Use like: h = rm_raincloud(data, colours, plot_top_to_bottom, density_type, bandwidth)
% Where 'data' is an M x N cell array of N data series and M measurements
% And 'colours' is an N x 3 array defining the colour to plot each data series
% h is a cell array containing handles of the various figure parts
% plot_top_to_bottom: Default plots left-to-right, set to 1 to rotate.
% density_type: 'ks' (default) or 'RASH'. 'ks' uses matlab's inbuilt 'ksdensity' to
% determine the shape of the rainclouds. 'RASH' will use the 'rst_RASH'
% method from Cyril Pernet's Robust Stats toolbox, if that function is on
% your matlab path.
% bandwidth: If density_type == 'ks', determines bandwidth of density estimate
% h is a cell array containing handles of the various figure parts:
% h.p{i,j} is the handle to the density plot from data{i,j}
% h.s{i,j} is the handle to the 'raindrops' (individual datapoints) from data{i,j}
% h.m(i,j) is the handle to the single, large dot that represents mean(data{i,j})
% h.l(i,j) is the handle for the line connecting h.m(i,j) and h.m(i+1,j)
%% TO-DO:
% Patch can create colour gradients using the 'interp' option to 'FaceColor'. Allow this?
...
...
@@ -51,6 +51,9 @@ for i = 1:nper
case
'ks'
[
ks
{
i
,
j
},
x
{
i
,
j
}]
=
ksdensity
(
data
{
i
,
j
},
'NumPoints'
,
nbins
(
i
,
j
),
'bandwidth'
,
bandwidth
);
case
'rash'
% check for rst_RASH function (from Robust stats toolbox) in path, fail if not found
assert
(
exist
(
'rst_RASH'
,
'file'
)
==
2
,
'Could not compute density using RASH method. Do you have the Robust Stats toolbox on your path?'
);
[
x
{
i
,
j
},
ks
{
i
,
j
}]
=
rst_RASH
(
data
{
i
,
j
});
% override default 'nbins' as rst_RASH determines number of bins
nbins
(
i
,
j
)
=
size
(
ks
{
i
,
j
},
2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment