Skip to content

Instantly share code, notes, and snippets.

@jnkather
Created July 22, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnkather/d486ba052eae7a011822 to your computer and use it in GitHub Desktop.
Save jnkather/d486ba052eae7a011822 to your computer and use it in GitHub Desktop.
Draw a tree on the current axes. Can be used to visualize spatial datasets as groups of trees.
function showTree( x,y,scale,varargin )
xsize = 0.01*scale;
ysize = 0.03*scale;
radius = 0.03*scale;
treeColor = [0,150,10]/255;
% override tree color
if nargin>3
treeColor = varargin{1}
end
rectangle('Position',[x,y,xsize,ysize],'Curvature',[0,0],'FaceColor',[91,51,35]/255,'EdgeColor','none');
rectangle('Position',[x-xsize,y+radius/2,radius,radius],'Curvature',[1,1],'FaceColor',treeColor,'EdgeColor','none');
axis equal
hold on
drawnow
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment