Ask Your Question

inset() and multi_graphics() are not defined

asked 2020-01-07 16:15:25 +0200

ssss gravatar image

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:


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)

The error:

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


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))])

The error:

Error in lines 4-4
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/", 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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-07 17:49:37 +0200

eric_g gravatar image

You are probably using an old version of SageMath in CoCalc. The functions inset() and multi_graphics() have been introduced in SageMath 9.0 (released on 1 January 2020). In the menu of the Jupyter notebook, do Kernel -> Change kernel and select "SageMath 9.0".

edit flag offensive delete link more


Yes, you are right. Thanks. Can you guide me how I can change sage worksheet kernel (.sagews)? Since the way you mentioned is for Jupyter (.ipynb)

ssss gravatar imagessss ( 2020-01-07 19:35:10 +0200 )edit

For Sage worksheets, this does not seem to be easily feasible. Please ask the question to the CoCalc forum.

eric_g gravatar imageeric_g ( 2020-01-07 19:52:34 +0200 )edit

@eric_g Thanks

ssss gravatar imagessss ( 2020-01-07 21:58:20 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-01-07 16:15:25 +0200

Seen: 163 times

Last updated: Jan 07 '20