Skip to content

Commit

Permalink
Solved minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
piermorel committed Jun 26, 2024
1 parent b7b85c3 commit d9f9843
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions gramm/@gramm/stat_smooth.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
temp_results=p.Results;
if isempty(temp_results.lambda)
switch temp_results.method
case 'perfect'
case 'eilers'
temp_results.lambda = 1000;
case 'smoothingspline'
temp_results.lambda = [];
Expand All @@ -60,7 +60,7 @@
%Define anonymous function for smoothing depending on method
switch params.method
case 'eilers'
fun=@(x,y)wrap_eilers(x,y,params.npoints,1000); %Standard value for cell/matrix input
fun=@(x,y)wrap_eilers(x,y,params.npoints,params.lambda); %Standard value for cell/matrix input
case 'smoothingspline'
fun=@(x,y)wrap_fit(x,y,params.npoints,params.lambda);
otherwise
Expand All @@ -82,8 +82,12 @@
for k=1:length(draw_data.y) %then we smooth each trajectory independently
if ~isempty(draw_data.y{k})

tmpx = shiftdim(draw_data.x{k});
tmpy = shiftdim(draw_data.y{k});
idnan=isnan(tmpx) | isnan(tmpy);

%[tempy(k,:),tempx(k,:)] = scatsm(draw_data.x{k}, draw_data.y{k}, params.lambda, 2, params.npoints);
[tempx(k,:),tempy(k,:)] = fun(shiftdim(draw_data.x{k}), shiftdim(draw_data.y{k}));
[tempx(k,:),tempy(k,:)] = fun(tmpx(~idnan), tmpy(~idnan));
end
end
hndl=plot(tempx',tempy','LineStyle',draw_data.line_style,'lineWidth',draw_data.line_size,'Color',draw_data.color);
Expand Down
4 changes: 2 additions & 2 deletions gramm/@gramm/stat_summary.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

%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
if (sum(strcmp(params.geom,'bar'))>0 || sum(strcmp(params.geom,'edge_bar'))>0) && draw_data.n_colors>1 %If we have a bar as geom, we dodge
params.dodge=0.6;
else
params.dodge=0;
Expand Down Expand Up @@ -273,7 +273,7 @@
end

%When we do bar plots we want to have zero in the y axis anyway
if sum(strcmp(params.geom,'bar'))>0
if sum(strcmp(params.geom,'bar'))>0 || sum(strcmp(params.geom,'edge_bar'))>0
if obj.plot_lim.miny(obj.current_row,obj.current_column)>0 %Values above zero -> change miny
obj.plot_lim.miny(obj.current_row,obj.current_column)=0;
end
Expand Down

0 comments on commit d9f9843

Please sign in to comment.