Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your question does not specify what you want to do :

  • Adding a new object to the same figure : this is done with the + operator (and the rel

Your question does not specify what you want to do :

  • Adding a new object to the same figure : this figure.

This is done with the + operator (and the relrelated += operator) :

sage: G= Graphics()
sage: G+=plot(sin,(-pi,pi))
sage: G+=plot(cos,(-pi,pi))

gets you a figure bearing two curves.

  • Adding a new figure to a graphic object holding figures.

This is done by creating a GraphicsArray object from the list of graphics you want to display :

from sage.plot.multigraphics import GraphicsArray
sage: G=GraphicsArray([plot(sin,(-pi,pi)),plot(cos,(-pi,pi))])

gets you an object holding two figures bearing one curve each.

Note that you (currently) can't append a new figure to an existing GraphicsArray:

sage: G.append([plot(exp,(-pi,1))])
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-57-a77afab4c542> in <module>
----> 1 G.append([plot(exp,(-pi,Integer(1)))])

/usr/local/sage-9/local/lib/python3.8/site-packages/sage/plot/multigraphics.py in append(self, g)
   1272         """
   1273         # Not clear if there is a way to do this
-> 1274         raise NotImplementedError('Appending to a graphics array is not '
   1275                                   'yet implemented')
   1276 

NotImplementedError: Appending to a graphics array is not yet implemented

HTH,