Skip to content

Commit

Permalink
Allow abline associated functions to receive 'linewidth' argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas-Schaub authored and Nick Schaub committed Mar 19, 2018
1 parent 1e7500b commit bbc69bb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions @gramm/draw.m
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@
xl=[mean(tmp_xl)-tmp_extent mean(tmp_xl)+tmp_extent];
if ~isnan(obj.abline.intercept(line_ind))
%abline
plot(xl,xl*obj.abline.slope(line_ind)+obj.abline.intercept(line_ind),obj.abline.style{line_ind},'Parent',ca);
plot(xl,xl*obj.abline.slope(line_ind)+obj.abline.intercept(line_ind),obj.abline.style{line_ind},'LineWidth',obj.abline.linewidth,'Parent',ca);
else
if ~isnan(obj.abline.xintercept(line_ind))
%vline
Expand All @@ -1203,14 +1203,14 @@
end
tmp_extent=(tmp_yl(2)-tmp_yl(1))*obj.abline.extent(line_ind)/2;
yl=[mean(tmp_yl)-tmp_extent mean(tmp_yl)+tmp_extent];
plot([obj.abline.xintercept(line_ind) obj.abline.xintercept(line_ind)],yl,obj.abline.style{line_ind},'Parent',ca);
plot([obj.abline.xintercept(line_ind) obj.abline.xintercept(line_ind)],yl,obj.abline.style{line_ind},'LineWidth',obj.abline.linewidth,'Parent',ca);
else
if ~isnan(obj.abline.yintercept(line_ind))
%hline
plot(xl,[obj.abline.yintercept(line_ind) obj.abline.yintercept(line_ind)],obj.abline.style{line_ind},'Parent',ca);
plot(xl,[obj.abline.yintercept(line_ind) obj.abline.yintercept(line_ind)],obj.abline.style{line_ind},'LineWidth',obj.abline.linewidth,'Parent',ca);
else
temp_x=linspace(xl(1),xl(2),500);
plot(temp_x,obj.abline.fun{line_ind}(temp_x),obj.abline.style{line_ind},'Parent',ca);
plot(temp_x,obj.abline.fun{line_ind}(temp_x),obj.abline.style{line_ind},'LineWidth',obj.abline.linewidth,'Parent',ca);
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion @gramm/geom_abline.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
my_addParameter(p,'intercept',0);
my_addParameter(p,'style','k--');
my_addParameter(p,'extent',2);
my_addParameter(p,'linewidth',1);
parse(p,varargin{:});

for obj_ind=1:numel(obj)
obj(obj_ind).abline=fill_abline(obj(obj_ind).abline,p.Results.slope,p.Results.intercept,NaN,NaN,@(x)x,p.Results.style,p.Results.extent);
obj(obj_ind).abline=fill_abline(obj(obj_ind).abline,p.Results.slope,p.Results.intercept,NaN,NaN,@(x)x,p.Results.style,p.Results.extent,p.Results.linewidth);
end
end
3 changes: 2 additions & 1 deletion @gramm/geom_hline.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
my_addParameter(p,'yintercept',0);
my_addParameter(p,'style','k--');
my_addParameter(p,'extent',2);
my_addParameter(p,'linewidth',1);
parse(p,varargin{:});

for obj_ind=1:numel(obj)
obj(obj_ind).abline=fill_abline(obj(obj_ind).abline,NaN,NaN,NaN,p.Results.yintercept,@(x)x,p.Results.style,p.Results.extent);
obj(obj_ind).abline=fill_abline(obj(obj_ind).abline,NaN,NaN,NaN,p.Results.yintercept,@(x)x,p.Results.style,p.Results.extent,p.Results.linewidth);
end
end
3 changes: 2 additions & 1 deletion @gramm/geom_vline.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
my_addParameter(p,'xintercept',0);
my_addParameter(p,'style','k--');
my_addParameter(p,'extent',2);
my_addParameter(p,'linewidth',1);
parse(p,varargin{:});

for obj_ind=1:numel(obj)
obj(obj_ind).abline=fill_abline(obj(obj_ind).abline,NaN,NaN,p.Results.xintercept,NaN,@(x)x,p.Results.style,p.Results.extent);
obj(obj_ind).abline=fill_abline(obj(obj_ind).abline,NaN,NaN,p.Results.xintercept,NaN,@(x)x,p.Results.style,p.Results.extent,p.Results.linewidth);
end
end
1 change: 1 addition & 0 deletions @gramm/gramm.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
'yintercept',[],...
'style',[],...
'fun',[],...
'linewidth',[],...
'extent',[])

%structure containing polygon parameters - Nicholas Schaub 2017-Mar-07
Expand Down
1 change: 1 addition & 0 deletions @gramm/private/fill_abline.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ab.xintercept(end+1:end+l)=shiftdim(varargin{3});
ab.yintercept(end+1:end+l)=shiftdim(varargin{4});
ab.extent(end+1:end+l)=shiftdim(varargin{7});
ab.linewidth(end+1:end+l)=shiftdim(varargin{8});

%Because of the constructor these are initialized as empty
%arrays
Expand Down

0 comments on commit bbc69bb

Please sign in to comment.