Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Flat colour in RegionPlot; millions of little triangles

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81712] Re: Flat colour in RegionPlot; millions of little triangles
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Tue, 2 Oct 2007 05:32:59 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fdkqst$7bk$1@smc.vnet.net> <46FDF56B.5070106@gmail.com> <fdl9e7$d1p$1@smc.vnet.net>

Will Robertson wrote:

> Hi Jean-Marc,
> 
> Thanks for the reply.
> 
> On 29/09/2007, at 16:19 , Jean-Marc Gulliet wrote:
>> Could you be more precise about the size of the exported files 
>> (before and after manual fixing) and about what size you expect and =
> 
>> deem as reasonable?
> 
> Sure, the example I posted is not particularly large or complex (but 
> it does demonstrate the problem). When calculating RegionPlot with a 
> troublesome function that requires a very tight mesh, however, the 
> problem is much worse. (Displaying the PDF in Acrobat Reader is 
> visibly delayed as it stops to draw every single blue polygon.)
> 
> I can't test out a more complicated example until I get back to my 
> office but you might find that this produces a more troublesome PDF:
>    ContourPlot[Sin[x y],{x,=E2=88=925,5},{y,=E2=88=925,5}]

Hi Will,

In version 6, the quality of a plot depends on the value of some new 
options such as *MaxRecursion* (my understanding is that this option 
controls the behavior of the new adaptative sampling algorithm) and also 
*PlotPoints*.

Below you will find sizes of pdf files created from *ContourPlot* with 
various settings of *MaxRecursion* and *PlotPoints*.

Using the default values, we can see that the pdf file is about 1.5 Mb, 
whereas, setting *MaxRecursion* to 0, the size is about 72 Kb, i.e 21 
times less.

Now, look at the quality (aesthetic) of the graph in both cases: the 
differences ares striking and the visual appearance of the former graph 
is so poor that it looks like it has not been produced by the same 
application (at least to my eyes :-)

You can find the evaluated notebook and a pdf version at

http://homepages.nyu.edu/~jmg336/mathematica/contour-plot.pdf

http://homepages.nyu.edu/~jmg336/mathematica/contour-plot.nb


In[1]:= $Version

Out[1]= "6.0 for Microsoft Windows (32-bit) (June 19, 2007)"

In[2]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  PlotLabel -> "MaxRecursion->Automatic\nPlotPoins->Automatic"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[4]= 1535524

In[5]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 0,
  PlotLabel -> "MaxRecursion->0\nPlotPoins->Automatic"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[7]= 72915

In[8]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 1,
  PlotLabel -> "MaxRecursion->0\nPlotPoins->Automatic"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[10]= 321697

In[11]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 2,
  PlotLabel -> "MaxRecursion->2\nPlotPoins->Automatic"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[13]= 1535522

In[14]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 2, PlotPoints -> 5,
  PlotLabel -> "MaxRecursion->2\nPlotPoins->5"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[16]= 214543

In[17]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 2, PlotPoints -> 6,
  PlotLabel -> "MaxRecursion->2\nPlotPoins->6"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[19]= 509790

In[20]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 2, PlotPoints -> 7,
  PlotLabel -> "MaxRecursion->2\nPlotPoins->7"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[22]= 602774

In[23]:= ContourPlot[Sin[x y], {x, -5, 5}, {y, -5, 5},
  MaxRecursion -> 2, PlotPoints -> 10,
  PlotLabel -> "MaxRecursion->2\nPlotPoins->10"]
Export["contour-plot.pdf", %];
ByteCount /. FileInformation[%]

Out[25]= 905323

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Re: 3D graphics resize unintentionally when rotated
  • Next by Date: Re: Dependence of precision on execution speed of Inverse
  • Previous by thread: Re: Flat colour in RegionPlot; millions of little triangles
  • Next by thread: Re: advanced fill effects for graphics primitives