MathGroup Archive 1999

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

Search the Archive

Re: ContourPlot: non-rectangular domains?

  • To: mathgroup at
  • Subject: [mg16951] Re: [mg16907] ContourPlot: non-rectangular domains?
  • From: "David Park" <djmp at>
  • Date: Thu, 8 Apr 1999 02:32:47 -0400
  • Sender: owner-wri-mathgroup at

Making a correction
David Johnson wrote:

>You could make 3D and contour plots with non-rectangular
>domains. This was accomplished by allowing the second range to be a
>function of the first variable. For instance, in Mathematica syntax,
>this would translate into something like the following:
> In[1]:= ContourPlot[x Sin[x] - Cos[y],
>   {x,-2,2},{y,x,2 x}]
>I have not been able to get Mathematica to duplicate this capability.
>Is there a simple way?

There are two other methods for making contour plots restricted to
specific regions, besides the one I outlined in my previous
communication which implements variable iterators.

The first method is to use the ConstrainedContourPlot routine that is
in the ExtendGraphics package that comes with Tom Wickham-Jones`s book
Mathematica Graphics. I guess it is also available from MathSource.
That routine allows an inequality constraint equation to be supplied
for the extent of the contour lines. However, it appears that the
routine plots only the contour lines and does not provide any contour

The second method is the most general and simplest in concept. Simply
design masking polygons(s). Then make the full contour plot and mask
it with the masking polyngons. The contour plot can be converted to
Graphics and then combined with the polygon in a Show statement.
This is all easier with my DrawingPaper package (available at my web
site)  because there ContourDraw is already a primitive Graphics
object; there is also a routine, StitchLineSegments, which makes it
easy to combine lines for a polygon, and some of the lines can be
obtained directly from plot routines that plot segments of curves.
With this method one can obtain quite general shapes which might not
be possible with variable iterators or a constraint inequality.

David Park
djmp at

  • Prev by Date: Re: ContourPlot: non-rectangular domains?
  • Next by Date: Re: ContourPlot: non-rectangular domains?
  • Previous by thread: Re: ContourPlot: non-rectangular domains?
  • Next by thread: Re: ContourPlot: non-rectangular domains?