# How to export 3D plot, without losing the specified view of rotation?

Sorry I am not sure if I got anything wrong with this version of Mathematica and Mac OS X i am running. But every time I export a 3D graph, to png or tiff, I lost the view angle, view vector viewpoint information immediately. To let you know what I meant, here is a simple code:

I typed:

x = RevolutionPlot3D[Sqrt[((t/5)^2 - 1)*2], {t, 5, 20}]


And I got a plot

out[1]=


Then I manually rotate the plot so that it looks better, for example like this:

Ok, now, I used Export to export it to png:

Export["test.png", %];


What I got is pathetically, the un-rotated png plot!:

This is driving me crazy and dead.. I also tried to set Viewpoint and view vector, stuff to the code, it doesn't work for me either. I also tried Export["test.png",x] too, no luck. I understand I could easily right-click to save, But I need a background-none option to make the graph transparent..

Can any one confirm (this bug?) or i am doing something stupidly wrong? I checked the documentation and googled for 1 hour, nothing found.

So the question is, how can I export the graph as it is shown on the notebook (if I can not, then what's the point of allowing us to rotate it..)

• RightClick + Save Graphics As... or File/Save Selection As... or Export["test.png", actual graphics] – Kuba Apr 9 '14 at 9:10
• You need to Export the actual rotated graphics or set the view options specifically. x is not changed by you rotating its graphical avatar. Related: mathematica.stackexchange.com/q/5375/131 – Yves Klett Apr 9 '14 at 9:24
• What did you mean by this? - "PS. I will be grateful like a dead man if Mathematica support plot tools like Matlab." – Vitaliy Kaurov Apr 9 '14 at 9:33
• @VitaliyKaurov yes, this sentence is somewhat open to interpretation :D – Yves Klett Apr 9 '14 at 9:45
• You have two good answers so I'll just comment to emphasise that % does not refer to the contents of the last output cell, it refers to the last output expression from the kernel. Nothing you do to the output cell changes the expression stored in %, whether it's rotating the graphics or even deleting it entirely and replacing it with a photo of your cat. – Simon Woods Apr 9 '14 at 12:22

What is stored in variable x is different from rotated object you have in output cell. You rotated - so you changed the properties. Many ways to do this - so in addition to comments' methods...

1) In-Export rotation

2) Seeing options

Export["test.png", Show[x, opts]]

• OP may be confused because he is not using x but %. – Kuba Apr 9 '14 at 9:35
• @Kuba yes, good point, I hope he reads comments ;-) – Vitaliy Kaurov Apr 9 '14 at 9:36
• Hi @Kuba thanks so much. I actually tried to export x directly, the result is the same (un-rotated png)~ I will try to copy the output to export to see thanks! – bboczeng Apr 9 '14 at 17:51
• In Export-Rotation works for me! – bboczeng Apr 9 '14 at 18:05

To save a PNG of a plot or graphics expression, I avoid Export. I select the displayed output and click on the Save Selection As ... item on the File menu. This will save the selected output exactly as it appears on the display.

• Hi @m_goldberg . The reason I wanted to use export is to make the background transparent. ! Save as can not make the background transparent. Thanks for your answer! – bboczeng Apr 9 '14 at 17:52
• also export can make the figure much better by setting ImageResolution->500 or so. – bboczeng Apr 9 '14 at 18:12

Mathematica has Export for 3D I'm unsure how well it exports to 3DStudio (in past versions, poorly).

The (see URLs) can Export to Renderer format (rayshade or povray) and does preserve things (the whole scene hopfully including text and tick marks - though that is little tested it has examples of 2D plots doing it well) - when they are supported (many things are, many not, Mathematica 11.0 is simply too huge to comment on).

and

Both rayshade and povray can be used to Rotate (manipulate) the resulting output realtime without Mathematica.

I like following solution which needs no context menu. The mouse is only needed to adjust the ViewPoint. It uses the answer by Yves Klett to Extract current viewing parameters from a 3D view?.

vp = Options[Graphics3D, ViewPoint][[1, 2]];

elongatedSquareGyrobicupola =
Graphics3D[{Gray, EdgeForm[{Thick}],
PolyhedronData["ElongatedSquareGyrobicupola", "GraphicsComplex"]},
ViewPoint -> Dynamic[vp], Lighting -> "Neutral", Boxed -> False]


Now do your manual adjustment of the ViewPoint and then add the export routine

Export["out.pdf",
GraphicsRow[{Show[
elongatedSquareGyrobicupola, {ViewPoint -> Dynamic[vp]}]},
ImageSize -> 1000]](*export as vector graphics*)