Ask Your Question

in command mode plot3d not displaying - only says "Graphics3d Object"

asked 2019-03-25 23:32:26 +0200

c05772 gravatar image
  • I use sagemath in a virtual machine ( To get a text copy of the output, and some latex and TikZ code it is convenient for me to use a linux terminal and launching something like

    /home/osboxes/SageMath/./sage /FilesSage/GSphereShowTest.sage | tee /FilesSage/GSphereShowTestOutput.txt

    the problem is I do not have a 3dplot: the terminal only states "Graphics3d Object".

  • To simplify I tried just

    /home/osboxes/SageMath/./sage /FilesSage/GSphereShowTest.sage

    to no avail.

  • There is already a question with a similar problem (plot3d not displaying - only says "Graphics3d Object"?!) but the solution does not apply. Here there is no max min.

The same test works without any problem with a sage terminal

The test code is just:

show(G, viewer='jmol')
print 'say Hello'``

What should be done to get access to the viewer in a linux terminal?

edit retag flag offensive close merge delete



show(G, viewer='threejs')


eric_g gravatar imageeric_g ( 2019-03-26 14:35:35 +0200 )edit

No, I tried the three viewers, jmol, tachyon and threejs.

c05772 gravatar imagec05772 ( 2019-03-26 16:19:38 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-26 09:00:48 +0200

Emmanuel Charpentier gravatar image

updated 2019-03-26 09:05:39 +0200

Sage does not write irs graphics output to the standard output. You have to save your graphic object to a file.

It also appears that 3D graphics can't be saved but to bitmap formats (and some specialized formats, which I don't know) :

`sage -c 'sphere((0, 0, 0), 1).save(filename="foo.png", viewer="tachyon")'`

works as advertised, but :

sage -c 'sphere((0, 0, 0), 1).save(filename="foo.pgf", viewer="tachyon")'
Traceback (most recent call last):
  File "/usr/local/sage-8/src/bin/sage-eval", line 10, in <module>
  File "<cmdline>", line 1, in <module>
  File "sage/plot/plot3d/base.pyx", line 1639, in (build/cythonized/sage/plot/plot3d/base.c:21846)
ValueError: filetype .pgf not supported by save()

You may try to save to one of the supported specialized 3D formants, and convert that to .pgf, gut I haven't the foggiest idea about the latter...


edit flag offensive delete link more


I think this answers the question (I tried the command

sage 'sphere((0, 0, 0), 1).save(filename="foo.png", viewer="tachyon")'

which works fine in the test program, no -c option), but of course it does solve not the problem which was to be able to export the Graphics3d object. At least it avoids spending hours looking a non-existing solution.

In a general way it is a weakness because the 3D jmol cannot be exported from the Windows version with jupyter either (cf. [] ) The only work around I see is to run the file twice, once in the terminal and cut and paste it i the browser of the virtual machine, run it and export the jmol figure from there with a right click.

c05772 gravatar imagec05772 ( 2019-03-26 21:15:14 +0200 )edit

As far as I know, you can export (dump) the Sage 3D object. But it can be loaded in Sage only but possibly on another platform)..

Similarly, you can export it to some specialized formats I know zilch about. If you happen to have the right libraries on your target machine, this might be an option.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2019-03-26 21:36:23 +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: 2019-03-25 23:32:26 +0200

Seen: 606 times

Last updated: Mar 26 '19