Is there a way to efficiently save the plot as .eps so that
1. the file is small
2. quality is still acceptable
3. recompiling the latex is fast
What are the necessery steps/settings that work best for that?
The best (?) way I found is to use "PrintSelection" and to print it into
a .pdf file. Then take a Graphics Program (on my Mac I use
GraphicsConverter for this) and save it as a .eps. This gives good
looking graphics of very moderate size.
--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
> I have to put a 3D Mathematica plot in a latex document so I save the plot
> by right clicking it and saving as .eps. ...
>
> Is there a way to efficiently save the plot as .eps so that
> 1. the file is small
> 2. quality is still acceptable
> 3. recompiling the latex is fast
Of course, the answer will depend, in part, on the specific graphics you
are rendering. Here's a specific example, for context.
p[r_, t_] := {r*Cos[t], r*Sin[t], Sin[-r^2]};
pic = ParametricPlot3D[p[r, t], {r, 0, Pi/2}, {t, 0, 2 Pi}]
If pic is then exported to EPS, the file size is nearly 4MB. I suppose
the file size is so large since the adaptive plotting procedures produce
a large number of points. I suppose the mesh doesn't look so good after
export to PDF since the mesh lines are generated independently of the
polygons.
An easy fix is to turn off the adaptive plotting procedures by setting
MaxRecusion->0 and to force the mesh lines to be right at the polygonal
edges by specifying Mesh->All.
p[r_, t_] := {r*Cos[t], r*Sin[t], Sin[-r^2]};
pic = ParametricPlot3D[p[r, t], {r, 0, Pi/2}, {t, 0, 2 Pi},
Mesh -> All, MaxRecursion -> 0, PlotPoints -> {15, 40}]
The resulting EPS file is only 800K and the line quality is much better.
Unfortunately, the polygons are all triangulated so the Mesh might not
be what you want.
If you're willing to do a little graphics programming, you can get a
quite satisfying result. The key point is to generate a collection of
rectangular patches for your surface and to collect them into a
GraphicsComplex with SurfaceNormals specified.
p[r_, t_] := {r*Cos[t], r*Sin[t], Sin[-r^2]};
dr = Pi/30; dt = Pi/20;
polygons =
Table[Polygon[{p[r, t], p[r + dr, t], p[r + dr, t + dt], p[r, t + dt]}],
{r, 0, Pi/2 - dr, dr}, {t, 0, 2 Pi - dt, dt}];
points = Union[Flatten[polygons /. Polygon[{pp__}] -> pp, 1]];
multigon = Polygon[Flatten[polygons /.
Polygon[{pp__}] :> Flatten[Position[points, #] & /@ {pp}], 1]];
n[r_, t_] = Cross[D[p[r, t], r], D[p[r, t], t]];
vns = Join[{{{0, 0, 0}, {0, 0, 1}}},
Flatten[Table[{p[r, t], n[r, t]}, {r, dr, Pi/2, dr},
{t, 0, 2 Pi - dt, dt}], 1]];
vns = Last /@ SortBy[vns, First];
pic = Graphics3D[GraphicsComplex[points, multigon,
VertexNormals -> vns]]
It's clearly a bit more work, but this version is reasonably sized
at 800K and looks pretty nice after export.
Mark McClure
In my (admittedly limited) experience:
* PDF files are generally substantially smaller in size than EPS files
for the same graphic content, and easier to work with; and
* There are certainly implementations of TeX and LaTeX (I think most of
the newer ones?) that allow one to put PDF files directly into LaTeX
documents.
Maybe this is the direction in which to look?
The TUG users group and TUGboat are recommended sources of info.
* Export it as a 3D geometry file
* Use movie15 LaTeX package
* Acrobat Reader 7 and above can render embedded 3D content.
* Tell us why it wouldn't work
On Jul 21, 2009, at 1:20 AM, Peter Breitfeld wrote:
> The best (?) way I found is to use "PrintSelection" and to print it
> into
> a .pdf file. Then take a Graphics Program (on my Mac I use
> GraphicsConverter for this) and save it as a .eps. This gives good
> looking graphics of very moderate size.
>
> --
> _________________________________________________________________
> Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
>
------------------------------------------------------------
Mobile (IT): +39 340 6104269
Home (IT): +39 0438 59360
Via Scossore, 94
31029 Vittorio Veneto (TV)
Italy
msn: dr.z...@hotmail.com
skype: filippo.miatto
Quantum Optics
Group Mail: mia...@molphys.leidenuniv.nl