Re: Using Mathematica 5.2 and 7.01 with separate settings

*To*: mathgroup at smc.vnet.net*Subject*: [mg104521] Re: Using Mathematica 5.2 and 7.01 with separate settings*From*: Alexey <lehin.p at gmail.com>*Date*: Tue, 3 Nov 2009 02:52:37 -0500 (EST)*References*: <h9ab6s$mmv$1@smc.vnet.net> <ha20tu$n2g$1@smc.vnet.net>

From: "Albert Retey" <awnl at gmx-topmail.de> Newsgroups: comp.soft-sys.math.mathematica Sent: Wednesday, October 28, 2009 12:20 PM Subject: [mg104521] Re: Using Mathematica 5.2 and 7.01 with separate settings >> Hello, >> As I have mentioned before, I need internal 2D-representation of >> Graphics3D as Graphics for having an ability to optimize 2D-vector >> representation of Graphics3D before exporting in vector format. >> Unfortunately, v.7 have no ability to transform Graphics3D into >> Graphics, try the following: >> >> In[1]:= << Version5`Graphics` >> g = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}] >> Graphics[g] >> >> During evaluation of In[1]:= GraphicsData["PostScript", "\<\ >> %! >> %%Creator: Mathematica >> %%AspectRatio: .81114 >> MathPictureStart >> .................... >> % End of Graphics >> MathPictureEnd >> \ >> \>"] >> >> Out[2]= - SurfaceGraphics - >> >> During evaluation of In[1]:= Graphics3D::optx: Unknown option >> DefaultAxesStyle in Options[Graphics3D]. >> >> >> Out[3]= - Graphics - >> >> The result of evaluation of Graphics[g] is an empty graphics instead >> of 2D-representation of 'g' as it is in v.5. > > you will just need select the graphics in the notebook and use the save > selection as menu entry to save it as EPS. The following does automate > the process: > > SetAttributes[exporteps,HoldRest] > exporteps[filename_,graphicscmd_]:=Module[{nb,ds,g}, > nb=CreateDocument[{ > ExpressionCell[Defer[Get["Version5`Graphics`"]],"Input"], > ExpressionCell[Defer[graphicscmd],"Input"], > ExpressionCell[Defer[Get["Version6`Graphics`"]],"Input"], > ExpressionCell[Defer[ > NotebookFind[EvaluationNotebook[],"Graphics",All,CellStyle]; > FE`Evaluate[ > FrontEnd`SaveSelectionAs[filename,EvaluationNotebook[],"EPS"] > ]; > NotebookClose[EvaluationNotebook[]] > ],"Input"] > }, > "ClosingSaveDialog"->False, > Visible->False > ]; > FrontEndTokenExecute[nb,"EvaluateNotebook"] > ] > > (* use it like this: *) > > exporteps[ > FileNameJoin[{$HomeDirectory,"Desktop","test.eps"}], > Plot3D[x*y,{x,0,1},{y,0,1}] > ] > Hello, First of all thank you for very interesting peace of code. Unfortunately, your response is only indirectly related to the problem mentioned above. The problem is not just to export high-quality EPS-file. I also need to possibly reduce its size prior to export by removing redundant points. I have 3D-line plot which contains more than 20000 point and exporting in huge eps-file. The line is smooth but have very sophisticated behavior and I really need so much points for having the plot to be of sufficient quality. But it is apparent that in 2D- version of this 3D-line I do not need more so much point because some (thousands!) of them are projected in a (approximately) one point. So, having internal Mathematica's 2D-representation of this line I could optimize number of point and produce a plot of the same quality but having a size of 10-50 times less. It is not difficult to get a projection of the line. But what really is the problem - is to get a 2D-projection of axes with ticks, labels and gridlines in the coordinate system of the line.