Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

inset() and multi_graphics() are not defined

Hi I am trying to plot two graphics beside each other, in a way that one of them which is smaller is on the upper left side of the other. I tried to run examples of both inset and multi_graphics on sagemath website. But I receive the error of "AttributeError: 'GraphicsArray' object has no attribute 'inset'" for inset, and the error of "NameError: name 'multi_graphics' is not defined" for multi_graphics.

I put my codes below:

Inset:

import matplotlib
G = graphics_array([plot(sin, (0, 2*pi)),plot(cos, (0, 2*pi))])
c = circle((0,0), 1, color='red', thickness=2, frame=True)
G.inset(c)

The error:

Error in lines 6-6
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1191, in execute
    flags=compile_flags), namespace, locals)
  File "", line 1, in <module>
AttributeError: 'GraphicsArray' object has no attribute 'inset'

multi_graphics:

g1 = plot(sin(x), (x, -10, 10), frame=True)
g2 = EllipticCurve([0,0,1,-1,0]).plot(color='red', thickness=2,axes_labels=['$x$', '$y$']) + text(r"$y^2 + y = x^3 - x$", (1.2, 2), color='red')
g3 = matrix_plot(matrix([[1,3,5,1], [2,4,5,6], [1,3,5,7]]))
G = multi_graphics([(g1, (0.125, 0.65, 0.775, 0.3)),(g2, (0.125, 0.11, 0.4, 0.4)),(g3, (0.55, 0.18, 0.4, 0.3))])
G

The error:

Error in lines 4-4
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1191, in execute
    flags=compile_flags), namespace, locals)
  File "", line 1, in <module>
NameError: name 'multi_graphics' is not defined

I'm working on CoCalc (SageMathCloud) on its unpaid trial server.