Skip to content

3d graphics can't be saved to a file #2872

@williamstein

Description

@williamstein

The bug is described below. To fix this and close this ticket, just slightly refactor the code in sage/sage/plot/plot3d/base.pyx so that save to png on a 3d image saves the tachyon rendered file, gives an sobj on an sobj or no extension, and gives an error on all other extension. This will be all one gets initially.

Another later ticket should -- if possible -- make it possible to get the static image from jmol (if possible).

On Thu, Apr 10, 2008 at 11:42 AM, Hector Villafuerte wrote:
> 
>  Hi,
>  I noticed the following (inconsistent?) behavior: saving 2D plots
>  works as expected (a graphic file is stored), but saving 3D plots
>  gives .sobj files instead (see sample code below). Is there a way to
>  save 3D plots from the Notebook? By the way, I know how to save them
>  using jMol's GUI (as reached from Sage terminal), but the idea is to
>  be able to script this.
>

This is a bug.  There's currently no easy nice way to script
saving 3d graphics using Tachyon.   If you do the following

  sage: p = point3d([(k,k^2,0) for k in [0..10]], size=5, viewer='tachyon')
  sage: p.show(filename='a', viewer='tachyon')

then the file a.png will be produced but unfortunately a browser window
will also appear showing this file.


>  --
>   Hector
>  
>  
>  sage: p = point([(k,k^2) for k in [0..10]])
>  sage: p.save(DATA+'plot2d.png')
>  sage: type(p)
>  <class 'sage.plot.plot.Graphics'>
>  
>  sage: p = point3d([(k,k^2,0) for k in [0..10]], size=5)
>  sage: p.save(DATA+'plot3d-1.png')
>  sage: type(p)
>  <class 'sage.plot.plot3d.base.Graphics3dGroup'>
>  
>  sage: p = point3d([(k,k^2,0) for k in [0..10]], size=5, viewer='tachyon')
>  sage: p.save(DATA+'plot3d-2.png')
>  sage: type(p)
>  <class 'sage.plot.plot3d.base.Graphics3dGroup'>

Depends on #8235

Component: graphics

Author: Bill Cauchois

Reviewer: Tim Dumol, Robert Bradshaw

Merged: sage-4.3.3.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/2872

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions