Previous Page Next Page Contents

plot::contour -- generate contour and implicit plots

Introduction

plot::contour([x, y, z], u = a..b, v = c..d) returns a contour plot of the surface defined by (u,v) -> (x(u,v); y(u,v); z(u,v)) with (u,v) in [a,b] x [c,d].

Call(s)

plot::contour([x, y, z], u = a..b, v = c..d <, option1, option2...>)

Parameters

x, y, z - arithmetical expressions in u and v
u, v - identifiers
option1, option2, ... - plot option(s) of the form option = value, including the special plot options Colors and Contours (see below)

Returns

an object of the domain type plot::Group.

Options

Colors - either the list [Flat <, color>], [Height <, fromColor, toColor>] or [Curve,color1...], where color, fromColor, toColor and color1... are RGB color specifications, i.e., lists of three real numerical values between 0 and 1.
Contours - either an integer greater than two, or a list of the form [r[1],...,r[n]] of real numerical values.

Related Functions

plot, plot2d, plot::density, plot::implicit

Details

Option: Colors

Option: Contours

Example 1

The following call returns an object representing a contour plot of the surface defined by (u,v) -> (u, v, exp(u*v) with (u,v) in [-1,1] x [-1,1]:

>> c:= plot::contour([x, y, exp(x*y)], x = -1..1, y = -1..1)
                               plot::Group()

To plot this object on the screen, call plot:

>> plot(c)

With the option Style = Attached, we get the following three-dimensional contour plot of the same surface:

>> plot(plot::contour(
     [x, y, exp(x*y)], x = -1..1, y = -1..1, Style = Attached
   ))

If you want to color the contour plot with respect to the height of the surface, you may enter:

>> plot(plot::contour(
     [x, y, exp(x*y)], x = -1..1, y = -1..1, Colors=[Height]
   ))

Here, the default color values from red to yellow are used.

Example 2

If you want to plot multiple contour plots in a single graphical scene, first create the desired contour plots, such as:

>> c1:= plot::contour(
       [x, y, sin(x*y)], x = -PI..PI, y = -PI..PI, Grid = [20,20]
   ):
   c2:= plot::contour(
       [x, y, x + 2*y], x= -PI..PI, y = -PI..PI, Colors=[Flat,RGB::Blue]
   ):

and collect them into a single graphical scene:

>> plot(c1, c2)

Example 3

We plot the implicit function defined by (x^2 + y^2)^3 - (x^2 - y^2)^2 = 0:

>> plot(plot::contour(
     [x, y, (x^2 + y^2)^3 - (x^2 - y^2)^2], x = -1..1, y = -1..1,
     Contours=[0], Grid=[20,20]
   ))

Anyway, you may prefer the function plot::implicit that is used to plot graphs of implicit functions and therefore usually yields better results:

>> plot(plot::implicit(
     (x^2 + y^2)^3 - (x^2 - y^2)^2, x = -1..1, y = -1..1
   ))

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000