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: [mg81728] Re: Flat colour in RegionPlot; millions of little triangles
  • From: Will Robertson <wspr81 at gmail.com>
  • Date: Tue, 2 Oct 2007 05:41:19 -0400 (EDT)
  • References: <fdkqst$7bk$1@smc.vnet.net><fdqcg4$mi1$1@smc.vnet.net>

Hi Ulises,

Thanks for your informative reply.

On Oct 1, 5:52 pm, ulises <uli... at wolfram.com> wrote:
> RegionPlot[
>  Abs[Nest[(#^2 + x + I y) &, x + I y, 16]] < 2, {x, -2, 1}, {y, -1.5,
>   1.5}, PlotStyle -> None]

Okay, this gives me an empty shape, which is a good start.
This gives the same result as Steve's suggestion
  g2 = g /. {Polygon[__] -> {}}

But now I've got an empty shape that I'd like to fill.

> Note that the interior polygons are tere for a reason, for example,
> this works as expected:
>
> g = RegionPlot[
>   Abs[Nest[(#^2 + x + I y) &, x + I y, 16]] < 2, {x, -2, 1}, {y, -1.5,
>     1.5}, PlotStyle -> None]
> g2 = g /. {Line[x_] -> {Line[x], Polygon[x]}}

I'm not sure what I should expect here, sorry. When I export this
image it is much larger than the original shaded image.

> you need an interior mesh in order to handle interior holes in
> regions, as well as general Mesh lines and other processing of other
> options.

Okay, that's fair enough.

Let's return to my original problem, which I've almost solved thanks
to everyone here.

g = RegionPlot[
  Abs[Nest[(#^2 + x + I y) &, x + I y, 16]] < 2, {x, -2, 1}, {y, -1.5,
    1.5}, MaxRecursion -> 5]
Export["large.svg", g];
g2 = g /. {Polygon[__] -> {}};
g3 = g2 /. {Line[x_] -> Polygon[x]}
Export["small.svg", g3];

large.svg is 831kB, small.svg is 62kB. Obviously MaxRecursion
magnifies the difference. This code produces a figure that is much
smaller (complexity and file size) compared to the original, while
printing *exactly the same shape* (viewing the original image in
Acrobat after PDF conversion, for example, is painfully slow). Further
fiddling is required to get the desired fill and edge colours, but I
assume it's not too hard.

Now, the solution above won't work for shapes that have interior
holes. That's too bad, but for some applications, no problem at all.
Presumably it's not impossible to generalise this solution for these
cases, but it's probably non-trivial (hmmm, or is it?). I'd have to
look into the details more, but I don't have time at the moment.

Thanks again for all your help,
Will Robertson



  • Prev by Date: Re: Modifying the Default stylesheet?
  • Next by Date: Re: Number of interval Intersections for a large number of intervals
  • Previous by thread: Re: Flat colour in RegionPlot; millions of little triangles
  • Next by thread: Re: Flat colour in RegionPlot; millions of little triangles