Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
public
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tom Marshall
public
Commits
d0b82399
Commit
d0b82399
authored
Mar 19, 2018
by
Tom Marshall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added function for making raincloud plots
parent
3fffecea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
prettier_sourceplots/.DS_Store
prettier_sourceplots/.DS_Store
+0
-0
raincloud_plots/.DS_Store
raincloud_plots/.DS_Store
+0
-0
raincloud_plots/how_to_make_a_raincloud_plot.m
raincloud_plots/how_to_make_a_raincloud_plot.m
+27
-0
raincloud_plots/raincloud_plot.m
raincloud_plots/raincloud_plot.m
+44
-0
No files found.
prettier_sourceplots/.DS_Store
0 → 100644
View file @
d0b82399
File added
raincloud_plots/.DS_Store
0 → 100644
View file @
d0b82399
File added
raincloud_plots/how_to_make_a_raincloud_plot.m
0 → 100644
View file @
d0b82399
% download open dataset from Marcus Munafo
% https://data.bris.ac.uk/datasets/112g2vkxomjoo1l26vjmvnlexj/2016.08.14_AnxietyPaper_Data%20Sheet.csv
mydir
=
'insert path here'
;
myfile
=
'2016.08.14_AnxietyPaper_Data Sheet.csv'
;
f
=
fopen
(
fullfile
(
mydir
,
myfile
));
dall
=
textscan
(
f
,
''
,
'HeaderLines'
,
1
,
'delimiter'
,
','
);
% just get the Anger, Disgust, Fear, and Happy conditions
d
=
[
dall
{
28
}
dall
{
29
}
dall
{
30
}
dall
{
31
}];
fclose
(
f
);
%% get nice colours from color brewer
% (https://uk.mathworks.com/matlabcentral/fileexchange/34087-cbrewer---colorbrewer-schemes-for-matlab)
[
cb
]
=
cbrewer
(
'qual'
,
'Set3'
,
10
,
'pchip'
);
%% plot
figure
;
subplot
(
4
,
1
,
1
),
raincloud_plot
(
d
(:,
1
),
cb
(
5
,:));
subplot
(
4
,
1
,
2
),
raincloud_plot
(
d
(:,
2
),
cb
(
7
,:));
subplot
(
4
,
1
,
3
),
raincloud_plot
(
d
(:,
3
),
cb
(
6
,:));
subplot
(
4
,
1
,
4
),
raincloud_plot
(
d
(:,
4
),
cb
(
4
,:));
\ No newline at end of file
raincloud_plots/raincloud_plot.m
0 → 100644
View file @
d0b82399
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
% density plot
h
{
1
}
=
area
(
b
,
a
);
hold
on
set
(
h
{
1
},
'FaceColor'
,
cl
);
set
(
h
{
1
},
'EdgeColor'
,
[
0.1
0.1
0.1
]);
set
(
h
{
1
},
'LineWidth'
,
2
);
% make some space under the density plot for the boxplot
yl
=
get
(
gca
,
'YLim'
);
set
(
gca
,
'YLim'
,[
-
2
yl
(
2
)]);
% jitter for raindrops
jit
=
(
rand
(
size
(
X
))
-
0.5
)
*
wdth
;
% info for making boxplot
Y
=
quantile
(
X
,[
0.25
0.75
0.5
0.02
0.98
]);
% '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
);
% 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
);
% 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
);
% raindrops
h
{
3
}
=
scatter
(
X
,
jit
-
1
);
h
{
3
}
.
SizeData
=
5
;
h
{
3
}
.
MarkerFaceColor
=
cl
;
h
{
3
}
.
MarkerEdgeColor
=
'none'
;
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