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
49667e5b
Commit
49667e5b
authored
May 01, 2019
by
Tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved to public for teaching
parent
dcefae19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
0 deletions
+52
-0
.DS_Store
.DS_Store
+0
-0
general_plotting/scatterbars.m
general_plotting/scatterbars.m
+39
-0
general_plotting/scatterline.m
general_plotting/scatterline.m
+13
-0
No files found.
.DS_Store
0 → 100644
View file @
49667e5b
File added
general_plotting/scatterbars.m
0 → 100644
View file @
49667e5b
% barplot with raw datapoints
% usage: h = scatterbars(data)
% where data is an n x m matrix of data
% plots m bars, with bar height 'nanmean(data)'
% optional second argument jitterWidth controls x-axis spread of dots
%
% example usage
% x = rand(30,4); % generate some raw data
% x(1:20,3) = NaN; % scatterbars can handle missing data
% figure; h = scatterbars(x); % plot
function
[
h
]
=
scatterbars
(
data
,
jitterWidth
)
% specify dot jitter width if not already specified
if
nargin
<
2
jitterWidth
=
0.2
;
end
% random jitter in the x-dimension for the dots
jitter
=
(
rand
(
size
(
data
))
-
0.5
)
*
jitterWidth
;
[
nRows
,
nCols
]
=
size
(
data
);
offsets
=
repmat
(
1
:
nCols
,
nRows
,
1
);
hold
on
% bar heights
means
=
nanmean
(
data
);
% plot
for
i
=
1
:
nCols
% bars
h
.
bar
(
i
)
=
bar
(
i
,
means
(
i
));
% dots
h
.
dots
(
i
)
=
scatter
((
jitter
(:,
i
)
+
offsets
(:,
i
)),
data
(:,
i
));
end
% apply some global properties to all dots
set
(
h
.
dots
,
'MarkerFaceColor'
,
[
0.5
0.5
0.5
]);
set
(
h
.
dots
,
'MarkerEdgeColor'
,
[
1
1
1
]);
\ No newline at end of file
general_plotting/scatterline.m
0 → 100644
View file @
49667e5b
function
[
h
,
h2
]
=
scatterline
(
data2plot
)
jit
=
(
rand
(
size
(
data2plot
))
-
0.5
)
*
0.1
;
[
nrows
,
ncolz
]
=
size
(
data2plot
);
offsets
=
repmat
(
1
:
ncolz
,
nrows
,
1
);
hold
on
h2
=
plot
(
mean
(
data2plot
));
h
=
scatter
((
jit
(:)
+
offsets
(:)),
data2plot
(:));
set
(
h
,
'MarkerFaceColor'
,[
0.5
0.5
0.5
]);
% set(h,'MarkerFaceAlpha',0.5);
% set(h,'MarkerEdgeAlpha',0.5);
set
(
h
,
'MarkerEdgeColor'
,[
1
1
1
]);
\ No newline at end of file
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