Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Orienting and Saving 3D Plots

Hi !

I am very new to using Sage, I've started only a few weeks ago. I hope my inability to answer anyone's questions won't ruin my "karma" ! Anyway, here is my first question:

I've been experimenting with plotting 3D objects, so far. Right now, I am plotting simple cubes scattered in space. With great satisfaction, I've noticed I could initialize the point of view of my 3D plot by specifying:

orientation(0,0,0,0)

That initializes to X being horizontal, Y vertical, and Z orthogonal to the screen. Then, I specify:

G.rotate([1,0,0],pi/4).show(aspect_ratio=[1,1,1],frame=False)

and get a point of view I really like. My goal is to generate a bunch of .png files of my cubes from different points of view, and I was hoping to use this rotate() functionality with a [ for i in range(n)] type statement. Therefore, I'd really like SAGE to write a bunch of .png files without me generating images one by one and saving manually. So I tried using the save() function, like so:

G.rotate([1,0,0],pi/4).save("MyImage.png",aspect_ratio=[1,1,1],frame=False)

Here is my problem: when I use the save() function, my previous orientation(0,0,0,0) statement is completely overridden, and the resulting MyImage.png I get is rotated according to rotate([1,0,0],pi/4), but not from the intented X being horizontal, Y vertical, and Z orthogonal to the screen configuration, rather, from the default point of view show() gives me, if I do not specify orientation(0,0,0,0).

Why is it so, and how can I fix this ?

Thank you very much, Turiel.