Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'ContourPlot: non-defined areas too big values' topicStudent Support Forum > General > "ContourPlot: non-defined areas <-> too big values"

Next Comment >Help | Reply To Topic
Author Comment/Response
igor igel
06/20/13 09:35am

Hi,

I am trying to create some ContourPlots for my first publication and having some problems with the styling. I will describe my problem here and describe a way that I guess solves it, with a litte problem I am still having, but I would be also very happy about different approaches to the design of the graph.

The function plotted approaches infinity in the corner on the bottom left and it is only defined at a part of the full range plotted. The graphic shall be black and white and hence the surrounding area is white and the values where it is defined is also white, what might look confusing to the reader, some example:

ContourPlot[
If[y > .5 x \[And] x > .5 y, 1/(x y)], {x, 0, 2}, {y, 0, 2},
ColorFunction -> GrayLevel,
RegionFunction -> Function[{x, y, z}, y > .5 x \[And] x > .5 y],
PlotLegends ->
Placed[BarLegend[Automatic, LegendMarkerSize -> {200, 200},
LegendFunction -> (Framed[#, RoundingRadius -> 0,
Background -> White, FrameMargins -> {{-1, -3}, {-14, -1}},
FrameStyle -> Black] &), LabelStyle -> {22}], {.82, .63}]]

my idea was to create a grid and boundary lines to help the reader understand where the function approaches to big values and where it is not defined:

ContourPlot[
If[y > .5 x \[And] x > .5 y, 1/(x y)], {x, 0, 2}, {y, 0, 2},
ColorFunction -> GrayLevel, GridLines -> Automatic,
RegionFunction -> Function[{x, y, z}, y > .5 x \[And] x > .5 y],
PlotLegends ->
Placed[BarLegend[Automatic, LegendMarkerSize -> {200, 200},
LegendFunction -> (Framed[#, RoundingRadius -> 0,
Background -> White, FrameMargins -> {{-1, -3}, {-14, -1}},
FrameStyle -> Black] &), LabelStyle -> {22}], {.82, .63}],
BoundaryStyle -> {Dashed, Gray}]

However the part where the values get to big is plotted transparent and hence the grid is also appearing there.
A solution might be timit the function with Min[... whereby ... is close to the value of the highest contourline

ContourPlot[
If[y > .5 x \[And] x > .5 y, Min[4, 1/(x y)]], {x, 0, 2}, {y, 0, 2},
ColorFunction -> GrayLevel, GridLines -> Automatic,
RegionFunction -> Function[{x, y, z}, y > .5 x \[And] x > .5 y],
PlotLegends ->
Placed[BarLegend[Automatic, LegendMarkerSize -> {200, 200},
LegendFunction -> (Framed[#, RoundingRadius -> 0,
Background -> White, FrameMargins -> {{-1, -3}, {-14, -1}},
FrameStyle -> Black] &), LabelStyle -> {22}], {.82, .63}],
BoundaryStyle -> {Dashed, Gray}]

That works, but the last contourline is not looking too nice and I will have to manually put a value close to the highest contourline into the Min[... function. It would be much better to determine this value automatically.
Do you know how to do that?

Or as I said I am open to different suggestion about the design :)

Thank you very much!
igor igel

URL: ,

Subject (listing for 'ContourPlot: non-defined areas <-> too big values')
Author Date Posted
ContourPlot: non-defined areas <-> too big values igor igel 06/20/13 09:35am
Re: ContourPlot: non-defined areas <-> too big ... Bill Simpson 06/20/13 5:37pm
Re: Re: ContourPlot: non-defined areas <-> too ... igor igel 06/21/13 1:10pm
Re: Re: Re: ContourPlot: non-defined areas <-> ... Bill Simpson 06/21/13 2:02pm
Re: Re: Re: ContourPlot: non-defined areas <-> ... igor igel 06/25/13 12:12pm
Re: Re: Re: Re: ContourPlot: non-defined areas ... igor igel 06/26/13 05:25am
Re: Re: Re: Re: Re: ContourPlot: non-defined ar... igor igel 06/26/13 1:09pm
Next Comment >Help | Reply To Topic