forked from piermorel/gramm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly draw confidence intervals, improved dodging
- User-provided confidence intervals can now be represented with geom_interval() - Improved dodging: now takes in account the number of colors per x value - Dodging supported in geom_point(), geom_line(), geom_jitter(), geom_bar() - Improved geom_bar() stacking
- Loading branch information
Showing
49 changed files
with
506 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
function obj = geom_interval( obj,varargin ) | ||
|
||
p=inputParser; | ||
my_addParameter(p,'geom','area'); | ||
my_addParameter(p,'dodge',[]); | ||
my_addParameter(p,'width',[]); | ||
parse(p,varargin{:}); | ||
|
||
obj.geom=vertcat(obj.geom,{@(dd)my_ci(obj,dd,p.Results)}); | ||
obj.results.geom_interval={}; | ||
|
||
end | ||
|
||
function hndl=my_ci(obj,draw_data,params) | ||
|
||
if isempty(draw_data.ymin) || isempty(draw_data.ymax) | ||
error('No ymin or ymax data for geom_ci'); | ||
end | ||
|
||
%Advanced defaults | ||
if isempty(params.dodge) | ||
if sum(strcmp(params.geom,'bar'))>0 && draw_data.n_colors>1 %If we have a bar as geom, we dodge | ||
params.dodge=0.6; | ||
else | ||
params.dodge=0; | ||
end | ||
end | ||
|
||
if isempty(params.width) %If no width given | ||
if params.dodge>0 %Equal to dodge if dodge given | ||
params.width=params.dodge*0.8; | ||
else | ||
params.width=0.5; | ||
end | ||
end | ||
|
||
if iscell(draw_data.x) | ||
for k=1:length(draw_data.x) | ||
plotci(obj,draw_data.x{k},draw_data.y{k},[draw_data.ymin{k} draw_data.ymax{k}],draw_data,params.geom,params.dodge,params.width); | ||
end | ||
else | ||
hndl=plotci(obj,draw_data.x,draw_data.y,[draw_data.ymin draw_data.ymax],draw_data,params.geom,params.dodge,params.width); | ||
end | ||
|
||
obj.results.geom_interval{obj.result_ind,1}=hndl; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.