Skip to main content

export - Speeding up EPS exporting ?


I'm using Mathematica 10 to render some figures, and I'm noticing some strange behaviour with EPS figures. I'm making figures like the one below in EPS format.


enter image description here


And to do so, I use some code like this;


(*Set up an option to reduce size of EPS files!!! *)
Map[SetOptions[#,
Prolog -> {{EdgeForm[], Texture[{{{0, 0, 0, 0}}}],

Polygon[#, VertexTextureCoordinates -> #] &[{{0, 0}, {1,
0}, {1, 1}}]}}] &, {Graphics3D, ContourPlot3D,
ListContourPlot3D, ListPlot3D, Plot3D, ListSurfacePlot3D,
ListContourPlot, ListVectorPlot3D, ParametricPlot3D, RegionPlot3D,
RevolutionPlot3D, SphericalPlot3D, VectorPlot3D, BarChart3D}];

M = Import["beta9.csv"];

(*Scans through the csv file, for every 1 draws Red sphere at a \
height of z = 42, for every 0.5 it draws a green sphere...*)

draw[0, _] = {};
draw[v : Except[0], {y_, x_}] := {v /. {0.5 -> Green, 1 -> Red},
Sphere[{x, y, 42}]};
J = Graphics3D[{Opacity[0.5], MapIndexed[draw, M, {2}]}];

(*pulls in another map to display under the spheres*)
O2map = Import["O2Nan.csv"];


setupimage =

ListPlot3D[O2map, MaxPlotPoints -> 300, Mesh -> None,
DataRange -> {{0, 200}, {0, 200}}, PlotRange -> {0, 40},
ColorFunction -> ColorData["TemperatureMap"],
BaseStyle -> {FontSize -> 14}, BoxRatios -> {1, 1, 1}];


t1 = Show[J, setupimage, BoxRatios -> {1, 0.5, 0.3},
PlotLabel -> "(a) Quick test data
", AxesLabel -> {None, None, "(Test Axis)"}, Axes -> True,
Ticks -> {{{0, 0}, {25, 125}, {50, 150}, {75, 375}, {100,

500}, {125, 625}, {150, 750}, {175, 875}, {200, 1000}}, {{0,
0}, {25, 125}, {50, 250}, {75, 375}, {100, 500}, {125,
625}, {150, 750}, {175, 875}, {200, 1000}}, {0, 10, 20, 30,
40}}, AxesStyle -> {Black, Black, Purple} ,
BaseStyle -> {FontSize -> 18}, ImageSize -> {800, 800},
ViewAngle -> All ]

This works fine, and renders quickly. To get an EPS, I simply enter


 Export["testdata1.eps",t1]


and it works fine, quickly producing an image file. However, if I load a different CSV (for example, beta6.csv) , the rendering in Mathematica is still quite quick and displays an image like this-


enter image description here


However, if I try using Export to eps, it takes literally hours and uses practically all of my systems 8gb of ram. Worse, if I try to export an image with lots of spheres like this


enter image description here


It renders in Mathematica but will not work with Export, forcing Windows to stop the process after many hours due to low memory. It would appear the process of exporting to an EPS causes problems, and the obvious solution might be to just use a different format but Im curious if there's a way around this. Also, does right clicking save as work differently than export? I'd try it but Im wary of freezing my machine yet again!


If anyone is curious, Sample data here - Underlying constant curve data , Rapid Export csv (shown in (a)), Loads of spheres, will freeze, as shown in (c)



Answer



You can export just the image to EPS by allowing rasterisation with the "AllowRasterization" option in Export.


Export["testdata1.eps",t1,"AllowRasterization"->True]


Hope this helps.


Comments

Popular posts from this blog

plotting - How to draw lines between specified dots on ListPlot?

I would like to create a plot where I have unconnected dots and some connected. So far, I have figured out how to draw the dots. My code is the following: ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4,13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full] I have thought using ListLinePlot command, but I don't know how to specify to the command to draw only selected lines between the dots. Do have any suggestions/hints on how to do that? Thank you. Answer One possibility would be to use Epilog with Line : ListPlot[ {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4, 13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full, Epilog -> { Line[ ...

equation solving - Invert and fit implicitly defined curve

I need to fit an implicitly defined curve. I thought I could get some data out of Solve , and then using FindFit . Therefore, I would like to find the relation the parametric curve defined by $F(x,y)=0$: Solve[-(1/2) + 1/2 (0.41202 BesselK[0, 0.1 Sqrt[x^2 + y^2]] + (0.101483 x BesselK[1, 0.1 Sqrt[x^2 + y^2]])/Sqrt[x^2 + y^2]) == 0, y] But I can't get an output: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help. >> Edit: In particular, I would like to fit the data coming from the curve with the expression of another curve, and not with a function $f(x)$. In particular, since this clearly looks like a cardioid , I would like it to fit to something like it. What other strategies could I try?

dynamic - How can I make a clickable ArrayPlot that returns input?

I would like to create a dynamic ArrayPlot so that the rectangles, when clicked, provide the input. Can I use ArrayPlot for this? Or is there something else I should have to use? Answer ArrayPlot is much more than just a simple array like Grid : it represents a ranged 2D dataset, and its visualization can be finetuned by options like DataReversed and DataRange . These features make it quite complicated to reproduce the same layout and order with Grid . Here I offer AnnotatedArrayPlot which comes in handy when your dataset is more than just a flat 2D array. The dynamic interface allows highlighting individual cells and possibly interacting with them. AnnotatedArrayPlot works the same way as ArrayPlot and accepts the same options plus Enabled , HighlightCoordinates , HighlightStyle and HighlightElementFunction . data = {{Missing["HasSomeMoreData"], GrayLevel[ 1], {RGBColor[0, 1, 1], RGBColor[0, 0, 1], GrayLevel[1]}, RGBColor[0, 1, 0]}, {GrayLevel[0], GrayLevel...