MathGroup Archive 2012

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

Search the Archive

Inconsistent behavior of RegionFunction in ContourPlot and ListContourPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127742] Inconsistent behavior of RegionFunction in ContourPlot and ListContourPlot
  • From: "Alexey Popkov" <lehin.p at gmail.com>
  • Date: Sat, 18 Aug 2012 03:44:03 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hello folks,

When trying to plot a non-covex set of datapoints ListContourPlot produces a 
convex graph effectively extrapolating values outside of the actual range of 
the original dataset:

pts = {{1, 1, 1}, {2, 1.2, .8}, {3, 1.3, .7}, {3, 2, 1}, {1.5, 2,
    1}, {1.5, 1.5, 1}};
epilog = {FaceForm[None], EdgeForm[Red], Polygon[Most /@ pts]};
ListContourPlot[pts, Epilog -> epilog]

(the red polygon shows the actual range of the data).

I need to remove the extrapolated parts of the graph and define 
RegionFunction:

leftBorder =
  Interpolation[pts[[{5, 6, 1}, {2, 1}]], InterpolationOrder -> 1];
bottomBorder =
  Interpolation[pts[[{1, 2, 3}, {1, 2}]], InterpolationOrder -> 1];
ListContourPlot[pts, Epilog -> epilog,
 RegionFunction ->
  Function[{x, y, z},
   x >= leftBorder[y] && y >= bottomBorder[x]]]

But as you see, nothing happens! The drawn region of the plot still contains 
areas outside of the area allowed by the RegionFunction.

There is no such problem with ContourPlot:

ContourPlot[Sin[x y], {x, 1, 3}, {y, 1, 2}, Epilog -> epilog,
 RegionFunction ->
  Function[{x, y, z}, x >= leftBorder[y] && y >= bottomBorder[x]]]

Is it a bug in ListContourPlot? How to achieve consistent behavior of 
RegionFunction in both ContourPlot and ListContourPlot?

Thanks in advance! 





  • Prev by Date: Re: Representing musical timings on a helix
  • Next by Date: TimeValue around NDSolve
  • Previous by thread: Re: Representing musical timings on a helix
  • Next by thread: Re: Inconsistent behavior of RegionFunction in ContourPlot and ListContourPlot