Creates ashaded surface representation of a regular or nearly regular gridded surface, with shading from either a light source model or from a specified array of intensities.
x
For example, x(0) specifies the x-coordinate for z(0, *). If x is a two-dimensional array, each element of x specifies the x-coordinate of the corresponding point in z (xij specifies the x-coordinate for zij).
y
For example, y(0) specifies the y-coordinate for z(*, 0). If y is a two-dimensional array, each element of y specifies the y-coordinate of the corresponding point in z (yij specifies the y-coordinate for zij).
Max_Img_Size
Shades
Other keywords are listed below. For a description of each keyword, see Chapter 3, Graphics and Plotting Keywords.
If the graphics output device has scalable pixels (e.g., PostScript), then the output image is scaled so that its largest dimension is less than or equal to 400. Use the Max_Img_Size keyword to increase this size.
When outputting to PostScript devices, the default for the Background keyword is white (index 255), rather than !P.Background.
Use the SET_SHADING procedure to control the direction of the light source and other shading parameters.
CAUTION: If the T3D keyword is set, the 3D to 2D transformation matrix contained in !P.T must project the z-axis to a line parallel to the device y-axis, or errors will occur.
If the X,Y grid is not regular or nearly regular, errors in hidden line removal will likely occur. In this case, you should use the SHADE_SURF_IRR procedure.
x = FINDGEN(101)/5 -10
Create 101-element vector of x-coordinates such that -10
x
10.
y = x
Make the vector of y-coordinates the same as the
; vector of
x
-coordinates.
z = FLTARR(101, 101)
Create a 101-by-101 array to hold the function values.
FOR i = 0, 100 DO BEGIN $
z (i, *) = x(i)*SIN(y) + y*COS(x(i)) $ - SIN(0.25*x(i)*y)
Insert the function values into z. Note that z is filled
; columnwise instead of elementwise.
SHADE_SURF, z, x, y, Ax = 50, XCharsize = 2, $ YCharsize = 2,ZCharsize = 2
Display the shaded surface. The Ax keyword is used
; to specify the desired angle of rotation about the x-axis.
; The XCharsize, YCharsize, and ZCharsize keywords are used
; to enlarge the characters used to annotate the axes.
XYOUTS, 118, 463, $ "f(x, y) = x*sin(y) + y*cos(x) - + sin(x*y)/4)", $ Charsize = 2, /Device
Place a title in the window. Note that the CURSOR
; procedure with the Device keyword was used to locate
; the proper position for the title.
Figure 2-105 Shaded surface with title.
Figure 2-106 Shaded surface with title.
This example creates data describing the surface defined by the function
shsurf.dat
in the columnar format described above. The data is then read from the file shsurf.dat
, placed in the data structures expected by SHADE_SURF, and displayed.
x = FINDGEN(101)/5 - 10 y = x
x = x # REPLICATE(1., 101) y = REPLICATE(1., 101) # y
z = x * y * cos(0.575 * x * y) - 10 * (x^2 + y^2)
OPENW, 1, 'shsurf.dat'
data = FLTARR(3, 101, 101)
data(0, *, *) = x data(1, *, *) = y data(2, *, *) = z
PRINTF, 1, Format = '(3f16.7)', data
CLOSE, 1
data = FLTARR(3, 101, 101)
OPENR, 1, 'shsurf.dat'
READF, 1, data
CLOSE, 1
x = REFORM(data(0, *, *))
y = REFORM(data(1, *, *))
z = REFORM(data(2, *, *))
SHADE_SURF, z, x, y, Ax = 50, Charsize = 2
The
Ax
; keyword is used to specify the desired angle of
rotation about the
x
-axis. The
Charsize
keywords are used
; to enlarge the characters used to annotate the axes.
Figure 2-107 Shaded surface defined in the example.
Figure 2-108 Shaded surface defined in the example.
SHADE_SURF, DIST(100), Ax=60