Skip to content

Commit

Permalink
Fixed bug with geom_interval() when ymin/ymax were provided as cells
Browse files Browse the repository at this point in the history
  • Loading branch information
piermorel committed Jun 28, 2017
1 parent 6a57225 commit 3e2f3df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion @gramm/geom_interval.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

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);
hndl = 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);
Expand Down
16 changes: 12 additions & 4 deletions @gramm/private/validate_aes.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@
if ~all(equal_lengths)
error('Cells in X and Y have different lengths');
end
if iscell(out.z)
equal_lengths=cellfun(@(y,z)length(y)==length(z),out.y,out.z);
if ~all(equal_lengths)
error('Cells in Z and X/Y have different lengths');

%Process facultative data that can be in cells
to_process = {'z' , 'ymin', 'ymax'};
for k = 1:length(to_process)
if iscell(out.(to_process{k}))
% Check lengths
equal_lengths=cellfun(@(y,z)length(y)==length(z),out.y,out.(to_process{k}));
if ~all(equal_lengths)
error(['Cells in ' to_process{k} ' and X/Y have different lengths']);
end
% Shiftdim cell contents
out.(to_process{k})=cellfun(@(c)shiftdim(c),out.(to_process{k}),'uniformOutput',false);
end
end
end
Expand Down

0 comments on commit 3e2f3df

Please sign in to comment.