Ask Your Question
0

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

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

c05772 gravatar image
  • I use sagemath in a virtual machine (osboxes.org). 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:

G=sphere((0,0,0),1)
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

Comments

Does

show(G, viewer='threejs')

work?

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

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

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

1 Answer

Sort by ยป oldest newest most voted
1

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

Emmanuel Charpentier gravatar image

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

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>
    eval(compile(s,'<cmdline>','exec'))
  File "<cmdline>", line 1, in <module>
  File "sage/plot/plot3d/base.pyx", line 1639, in sage.plot.plot3d.base.Graphics3d.save (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...

HTH,

edit flag offensive delete link more

Comments

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. [https://ask.sagemath.org/question/392...] ) 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 +0100 )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 +0100 )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

Stats

Asked: 2019-03-25 23:32:26 +0100

Seen: 697 times

Last updated: Mar 26 '19