Re: Transparent ContourPlot - Minor error at the origin
- To: mathgroup at smc.vnet.net
- Subject: [mg123797] Re: Transparent ContourPlot - Minor error at the origin
- From: Syd Geraghty <sydgeraghty at me.com>
- Date: Mon, 19 Dec 2011 07:22:09 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201112161052.FAA06915@smc.vnet.net>
Heike,
I noticed that the mesh function chosen automatically led to a mis-colouring of a small triangle at the origin which can be corrected by using a MaxRecursion of 7.
ContourPlot[x y^2 + 2, {x, -2, 2}, {y, -2, 2}, PlotRange -> {-10, 10},
ImageSize -> 600, MaxRecursion -> 7,
Method -> {"GridLinesInFront" -> True,
"TransparentPolygonMesh" -> True},
ColorFunction -> (Directive[Opacity[.5], ColorData["Rainbow"][#]] &),
ContourShading -> Automatic, GridLines -> Automatic]
Cheers .... Syd
Syd Geraghty B.Sc, M.Sc.
sydgeraghty at me.com
Mathematica 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
ReleaseID: 8.0.1.0 (2063982, 2063639)
MacOS X V 10.7.1 Lion
MacBook Pro 2.33 GHz Intel Core 2 Duo 3GB RAM
On Dec 18, 2011, at 1:34 AM, Heike Gramberg wrote:
> To draw grid lines on top of the plot, you could use the (undocumented) option
> Method->{"GridLinesInFront"->True}, so you could do something like
>
> ContourPlot[x y^2 + 2, {x, -2, 2}, {y, -2, 2},
> PlotRange -> {-10, 10},
> Method -> {"GridLinesInFront" -> True},
> GridLines -> Automatic]
>
> If you still want to have a transparent shading, you probably want to set
> Method -> {"TransparentPolygonMesh" -> True} as well which will get rid of the edges of
> the individual polygons. You can combine these two options as follows
>
> ContourPlot[x y^2 + 2, {x, -2, 2}, {y, -2, 2},
> PlotRange -> {-10, 10},
> Method -> {"GridLinesInFront" -> True, "TransparentPolygonMesh" -> True},
> ColorFunction -> (Directive[Opacity[.5], ColorData["Rainbow"][#]] &),
> ContourShading -> Automatic,
> GridLines -> Automatic]
>
> Heike
>
> On 16 Dec 2011, at 11:52, dg wrote:
>
>> I have been trying to create a contour plot where the contour shading is transparent, so that I can draw gridlines and see them through the contours. I can't seem to figure this one out....
>>
>> This produces a mess:
>>
>> ContourPlot[x y^2 + 2, {x, -2, 2}, {y, -2, 2}, PlotRange -> {-10, 10},
>> ContourShading -> {Orange, Opacity[0.5]}]
>>
>
>
- References:
- Transparent ContourPlot
- From: dg <davide.guarisco@gmail.com>
- Transparent ContourPlot