I want to create a plot by traversing a tree where some leaves of the data structure add line segments. I am trying to pass one graphics object to a function that adds a line segment to the graphics object. I assumed the graphics object is passed by reference so that changes inside the function would affect the original graphics object. However, that is not the case. How can one build up a graphics object via function calls?