Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13819 > unrolled thread

Visible mesh edges in PDF output of 3D graphic

Started byDavid Reiss <dbreiss@gmail.com>
First post2013-03-13 08:18 +0000
Last post2013-04-01 04:57 +0000
Articles 7 — 5 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Visible mesh edges in PDF output of 3D graphic David Reiss <dbreiss@gmail.com> - 2013-03-13 08:18 +0000
    Re: Visible mesh edges in PDF output of 3D graphic Peter Pein <petsie@dordos.net> - 2013-03-14 11:13 +0000
      Re: Visible mesh edges in PDF output of 3D graphic David Reiss <dbreiss@gmail.com> - 2013-03-15 05:46 +0000
      Re: Visible mesh edges in PDF output of 3D graphic JUN <noeckel@gmail.com> - 2013-03-15 05:46 +0000
        Re: Visible mesh edges in PDF output of 3D graphic David Reiss <dbreiss@gmail.com> - 2013-03-16 07:14 +0000
    Re: Visible mesh edges in PDF output of 3D graphic RBaillie <bobbaillie@frii.com> - 2013-03-17 07:08 +0000
      Re: Visible mesh edges in PDF output of 3D graphic debguy <johnandsara2@cox.net> - 2013-04-01 04:57 +0000

#13819 — Visible mesh edges in PDF output of 3D graphic

FromDavid Reiss <dbreiss@gmail.com>
Date2013-03-13 08:18 +0000
SubjectVisible mesh edges in PDF output of 3D graphic
Message-ID<khpcon$me2$1@smc.vnet.net>
Consider the following plot:

graphicTest=
ContourPlot3D[{h==0,g==0},{x,-2,2},{y,-2,2},{z,-2,2},
MeshFunctions->{Function[{x,y,z,f},h-g]},
MeshStyle->{{Thick,Black,Opacity[1]}},
Mesh->{{0}},
ContourStyle->{
Directive[Orange,Opacity[.5],Specularity[White,30]],
Directive[Purple,Opacity[.3],Specularity[Green,30]]},
PlotPoints->30,
Boxed->False,
(*Axes->False,*)
BoxRatios->Automatic,
PlotRange->{All,All,{-2,2}}
]


Then export it as a PDF and look at it in a PDF viewer (insert your
directory path at <<<your directory path here>>> to make this work):

Export["<<<your directory path here>>>/
testGraph.pdf",graphicTest,"PDF"]//SystemOpen

Look at the resulting PDF.  You will see the lattice of the underlying
plot mesh visible.  Is there any way to get rid of this?  Note that I
expect to see the fasceted nature of the graphic, but the explicit
differently colored edges are not desired.

[toc] | [next] | [standalone]


#13832

FromPeter Pein <petsie@dordos.net>
Date2013-03-14 11:13 +0000
Message-ID<khsbc5$36i$1@smc.vnet.net>
In reply to#13819
Am 13.03.2013 09:18, schrieb David Reiss:
> Consider the following plot:
>
> graphicTest=
> ContourPlot3D[{h==0,g==0},{x,-2,2},{y,-2,2},{z,-2,2},
> MeshFunctions->{Function[{x,y,z,f},h-g]},
> MeshStyle->{{Thick,Black,Opacity[1]}},
> Mesh->{{0}},
> ContourStyle->{
> Directive[Orange,Opacity[.5],Specularity[White,30]],
> Directive[Purple,Opacity[.3],Specularity[Green,30]]},
> PlotPoints->30,
> Boxed->False,
> (*Axes->False,*)
> BoxRatios->Automatic,
> PlotRange->{All,All,{-2,2}}
> ]
>
>
> Then export it as a PDF and look at it in a PDF viewer (insert your
> directory path at <<<your directory path here>>> to make this work):
>
> Export["<<<your directory path here>>>/
> testGraph.pdf",graphicTest,"PDF"]//SystemOpen
>
> Look at the resulting PDF.  You will see the lattice of the underlying
> plot mesh visible.  Is there any way to get rid of this?  Note that I
> expect to see the fasceted nature of the graphic, but the explicit
> differently colored edges are not desired.
>

Hi David,

  as you did not provide us with the definitions of g and h, I invented 
some toy expressions:
{g, h} = Plus @@@
    Through[{Cos, 1 - 2 Sinc[#/2]^2 &}[Pi*{x, y, z}]];

The plain export to PDF results in a 110 MB file with which the 
Adobe-Reader has got hard times (it crashes on my 12GB-box). GS-View 
works and I can see the many lines.

  If losing the scalability is acceptable,

Export[ToFileName[{$HomeDirectory, "Desktop"}, "test2.pdf"],
  Rasterize[graphicTest, ImageSize -> 1200], ImageResolution -> 300]

might help (resulting in a 633 KB PDF file). I tried an export without 
explicit rasterization via the options "AllowRasterization"->True and 
ImageResolution -> 300 in the call to Export[], but it did not look as 
nice as the result of the above line. Maybe I misunderstood the meaning 
of this option :(

hth,
Peter

[toc] | [prev] | [next] | [standalone]


#13845

FromDavid Reiss <dbreiss@gmail.com>
Date2013-03-15 05:46 +0000
Message-ID<khucje$8k$1@smc.vnet.net>
In reply to#13832
Whoops!

height = .5;
h = x^2 + y^2 + (z - height)^2 - 1;
g = z;

I will take a look at your approach.  However, I do need to keep
scalability.  Otherwise I cols simply export at PNG, or TIFF.

Thanks,
David


On Mar 14, 7:13 am, Peter Pein <pet...@dordos.net> wrote:
> Am 13.03.2013 09:18, schrieb David Reiss:
>
>
>
>
>
>
>
>
>
> > Consider the following plot:
>
> > graphicTest=
> > ContourPlot3D[{h==0,g==0},{x,-2,2},{y,-2,2},{z,-2,2},
> > MeshFunctions->{Function[{x,y,z,f},h-g]},
> > MeshStyle->{{Thick,Black,Opacity[1]}},
> > Mesh->{{0}},
> > ContourStyle->{
> > Directive[Orange,Opacity[.5],Specularity[White,30]],
> > Directive[Purple,Opacity[.3],Specularity[Green,30]]},
> > PlotPoints->30,
> > Boxed->False,
> > (*Axes->False,*)
> > BoxRatios->Automatic,
> > PlotRange->{All,All,{-2,2}}
> > ]
>
> > Then export it as a PDF and look at it in a PDF viewer (insert your
> > directory path at <<<your directory path here>>> to make this work):
>
> > Export["<<<your directory path here>>>/
> > testGraph.pdf",graphicTest,"PDF"]//SystemOpen
>
> > Look at the resulting PDF.  You will see the lattice of the underlyin=
g
> > plot mesh visible.  Is there any way to get rid of this?  Note that=
 I
> > expect to see the fasceted nature of the graphic, but the explicit
> > differently colored edges are not desired.
>
> Hi David,
>
>   as you did not provide us with the definitions of g and h, I invented
> some toy expressions:
> {g, h} = Plus @@@
>     Through[{Cos, 1 - 2 Sinc[#/2]^2 &}[Pi*{x, y, z}]];
>
> The plain export to PDF results in a 110 MB file with which the
> Adobe-Reader has got hard times (it crashes on my 12GB-box). GS-View
> works and I can see the many lines.
>
>   If losing the scalability is acceptable,
>
> Export[ToFileName[{$HomeDirectory, "Desktop"}, "test2.pdf"],
>   Rasterize[graphicTest, ImageSize -> 1200], ImageResolution -> 300]
>
> might help (resulting in a 633 KB PDF file). I tried an export without
> explicit rasterization via the options "AllowRasterization"->True and
> ImageResolution -> 300 in the call to Export[], but it did not look as
> nice as the result of the above line. Maybe I misunderstood the meaning
> of this option :(
>
> hth,
> Peter

[toc] | [prev] | [next] | [standalone]


#13847

FromJUN <noeckel@gmail.com>
Date2013-03-15 05:46 +0000
Message-ID<khucjo$8u$1@smc.vnet.net>
In reply to#13832
On Thursday, March 14, 2013 4:13:09 AM UTC-7, Peter Pein wrote:
> Am 13.03.2013 09:18, schrieb David Reiss:
> 
> > Consider the following plot:
> 
> >
> 
> > graphicTest=
> 
> > ContourPlot3D[{h==0,g==0},{x,-2,2},{y,-2,2},{z,-2,2},
> 
> > MeshFunctions->{Function[{x,y,z,f},h-g]},
> 
> > MeshStyle->{{Thick,Black,Opacity[1]}},
> 
> > Mesh->{{0}},
> 
> > ContourStyle->{
> 
> > Directive[Orange,Opacity[.5],Specularity[White,30]],
> 
> > Directive[Purple,Opacity[.3],Specularity[Green,30]]},
> 
> > PlotPoints->30,
> 
> > Boxed->False,
> 
> > (*Axes->False,*)
> 
> > BoxRatios->Automatic,
> 
> > PlotRange->{All,All,{-2,2}}
> 
> > ]
> 
> >
> 
> >
> 
> > Then export it as a PDF and look at it in a PDF viewer (insert your
> 
> > directory path at <<<your directory path here>>> to make this work):
> 
> >
> 
> > Export["<<<your directory path here>>>/
> 
> > testGraph.pdf",graphicTest,"PDF"]//SystemOpen
> 
> >
> 
> > Look at the resulting PDF.  You will see the lattice of the underlying
> 
> > plot mesh visible.  Is there any way to get rid of this?  Note that I
> 
> > expect to see the fasceted nature of the graphic, but the explicit
> 
> > differently colored edges are not desired.
> 
> >
> 
> 
> 
> Hi David,
> 
> 
> 
>   as you did not provide us with the definitions of g and h, I invented 
> 
> some toy expressions:
> 
> {g, h} = Plus @@@
> 
>     Through[{Cos, 1 - 2 Sinc[#/2]^2 &}[Pi*{x, y, z}]];
> 
> 
> 
> The plain export to PDF results in a 110 MB file with which the 
> 
> Adobe-Reader has got hard times (it crashes on my 12GB-box). GS-View 
> 
> works and I can see the many lines.
> 
> 
> 
>   If losing the scalability is acceptable,
> 
> 
> 
> Export[ToFileName[{$HomeDirectory, "Desktop"}, "test2.pdf"],
> 
>   Rasterize[graphicTest, ImageSize -> 1200], ImageResolution -> 300]
> 
> 
> 
> might help (resulting in a 633 KB PDF file). I tried an export without 
> 
> explicit rasterization via the options "AllowRasterization"->True and 
> 
> ImageResolution -> 300 in the call to Export[], but it did not look as 
> 
> nice as the result of the above line. Maybe I misunderstood the meaning 
> 
> of this option :(
> 
> 
> 
> hth,
> 
> Peter

What I do in these cases is described here:
http://mathematica.stackexchange.com/a/1551/245

Before making any plots, execute this command:

Map[SetOptions[#, 
    Prolog -> {{EdgeForm[], Texture[{{{0, 0, 0, 0}}}], 
       Polygon[#, VertexTextureCoordinates -> #] &[{{0, 0}, {1, 
          0}, {1, 1}}]}}] &, {Graphics3D, ContourPlot3D, 
   ListContourPlot3D, ListPlot3D, Plot3D, ListSurfacePlot3D, 
   ListVectorPlot3D, ParametricPlot3D, RegionPlot3D, RevolutionPlot3D,
    SphericalPlot3D, VectorPlot3D}];


Jens

[toc] | [prev] | [next] | [standalone]


#13856

FromDavid Reiss <dbreiss@gmail.com>
Date2013-03-16 07:14 +0000
Message-ID<ki164h$5vb$1@smc.vnet.net>
In reply to#13847
On Mar 15, 1:46 am, JUN <noec...@gmail.com> wrote:
> On Thursday, March 14, 2013 4:13:09 AM UTC-7, Peter Pein wrote:
> > Am 13.03.2013 09:18, schrieb David Reiss:
>
> > > Consider the following plot:
>
> > > graphicTest=
>
> > > ContourPlot3D[{h==0,g==0},{x,-2,2},{y,-2,2},{z,-2,2},
>
> > > MeshFunctions->{Function[{x,y,z,f},h-g]},
>
> > > MeshStyle->{{Thick,Black,Opacity[1]}},
>
> > > Mesh->{{0}},
>
> > > ContourStyle->{
>
> > > Directive[Orange,Opacity[.5],Specularity[White,30]],
>
> > > Directive[Purple,Opacity[.3],Specularity[Green,30]]},
>
> > > PlotPoints->30,
>
> > > Boxed->False,
>
> > > (*Axes->False,*)
>
> > > BoxRatios->Automatic,
>
> > > PlotRange->{All,All,{-2,2}}
>
> > > ]
>
> > > Then export it as a PDF and look at it in a PDF viewer (insert your
>
> > > directory path at <<<your directory path here>>> to make this work):
>
> > > Export["<<<your directory path here>>>/
>
> > > testGraph.pdf",graphicTest,"PDF"]//SystemOpen
>
> > > Look at the resulting PDF.  You will see the lattice of the underlying
>
> > > plot mesh visible.  Is there any way to get rid of this?  Note that I
>
> > > expect to see the fasceted nature of the graphic, but the explicit
>
> > > differently colored edges are not desired.
>
> > Hi David,
>
> >   as you did not provide us with the definitions of g and h, I invented
>
> > some toy expressions:
>
> > {g, h} = Plus @@@
>
> >     Through[{Cos, 1 - 2 Sinc[#/2]^2 &}[Pi*{x, y, z}]];
>
> > The plain export to PDF results in a 110 MB file with which the
>
> > Adobe-Reader has got hard times (it crashes on my 12GB-box). GS-View
>
> > works and I can see the many lines.
>
> >   If losing the scalability is acceptable,
>
> > Export[ToFileName[{$HomeDirectory, "Desktop"}, "test2.pdf"],
>
> >   Rasterize[graphicTest, ImageSize -> 1200], ImageResolution -> 300]
>
> > might help (resulting in a 633 KB PDF file). I tried an export without
>
> > explicit rasterization via the options "AllowRasterization"->True and
>
> > ImageResolution -> 300 in the call to Export[], but it did not look as
>
> > nice as the result of the above line. Maybe I misunderstood the meaning
>
> > of this option :(
>
> > hth,
>
> > Peter
>
> What I do in these cases is described here:http://mathematica.stackexchange.com/a/1551/245
>
> Before making any plots, execute this command:
>
> Map[SetOptions[#,
>     Prolog -> {{EdgeForm[], Texture[{{{0, 0, 0, 0}}}],
>        Polygon[#, VertexTextureCoordinates -> #] &[{{0, 0}, {1,
>           0}, {1, 1}}]}}] &, {Graphics3D, ContourPlot3D,
>    ListContourPlot3D, ListPlot3D, Plot3D, ListSurfacePlot3D,
>    ListVectorPlot3D, ParametricPlot3D, RegionPlot3D, RevolutionPlot3D,
>     SphericalPlot3D, VectorPlot3D}];
>
> Jens

Jens,

This appears to do the trick.  Thanks so much...
best,
David

[toc] | [prev] | [next] | [standalone]


#13862

FromRBaillie <bobbaillie@frii.com>
Date2013-03-17 07:08 +0000
Message-ID<ki3q61$at5$1@smc.vnet.net>
In reply to#13819
Exporting 3d graphics to pdf hasn't worked well since version 5.2.
That's why I keep a copy of version 5.2 around.

Anyway, including the
  "AllowRasterization" -> False
option greatly reduces the file size:

plt = ...
Export["C:\\junk\\plt.pdf", plt, "AllowRasterization" -> False]

[toc] | [prev] | [next] | [standalone]


#13991

Fromdebguy <johnandsara2@cox.net>
Date2013-04-01 04:57 +0000
Message-ID<kjb43g$8jo$1@smc.vnet.net>
In reply to#13862
I'm interested if the initail post sees this.  what exactly about the
edges of the plot show poorly?  can you post the image?  (newsgroups
used to allow files - unsure if this one does)

[No attachements are not allowed - Moderator]

your (allowing) edgeform by making graphics that show meshes (uses
edgeform) and then removing them later?  won't that leave spaces
between the polygons where the edgeforms go? (unsure if it would be
visible)

it's not necessarily Mathematica when pdf isn't perfect.  what pdf
viewer?  many aren't perfect or right version. and  is pdf installed
properly on your system?  it, are all the necessary device targes
available as adobe would and operate the same?  pdf isn't simple.
works darn good though!

well i'm sure the issue is resolved anyway

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web