The PLOT_3DBOX procedure plots a function of two variables (e.g., Z=f(X, Y)) inside a 3-D box. Optionally, the data can be projected onto the “walls” surrounding the plot area.
This routine is written in the IDL language. Its source code can be found in the file plot_3dbox.pro in the lib subdirectory of the IDL distribution.
Examples
X = REPLICATE(5., 10.)
X1 = COS(FINDGEN(36)*10.*!DTOR)*2.+5.
X = [X, X1, X]
Y = FINDGEN(56)
Z = REPLICATE(5., 10)
Z1 = SIN(FINDGEN(36)*10.*!DTOR)*2.+5.
Z = [Z, Z1, Z]
PLOT_3DBOX, X, Y, Z, /XY_PLANE, /YZ_PLANE, /XZ_PLANE, $
/SOLID_WALLS, GRIDSTYLE=1, XYSTYLE=3, XZSTYLE=4, $
YZSTYLE=5, AZ=40, TITLE='Example Plot Box', $
XTITLE='X Coordinate', YTITLE='Y Coodinate', $
ZTITLE='Z Coordinate', SUBTITLE='Sub Title', $
/YSTYLE, ZRANGE=[0,10], XRANGE=[0,10], $
PSYM=-4, CHARSIZE=1.6
Syntax
PLOT_3DBOX, X, Y, Z [, AX=degrees] [, AZ=degrees] [, GRIDSTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, PSYM=integer{1 to 10}] [, /SOLID_WALLS] [, /XY_PLANE] [, XYSTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, /XZ_PLANE] [, XZSTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, /YZ_PLANE] [, YZSTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, ZAXIS={1 | 2 | 3 | 4}]
Graphics Keywords:[, BACKGROUND=color_index] [, CHARSIZE=value] [, CHARTHICK=integer] [, CLIP=[X0, Y0, X1, Y1]] [, COLOR=value] [, /DATA| , /DEVICE| , /NORMAL] [, LINESTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, /NOCLIP] [, /NODATA] [, /NOERASE] [, POSITION=[X0, Y0, X1, Y1]] [, SUBTITLE=string] [, /T3D] [, THICK=value] [, TICKLEN=value] [, TITLE=string]
[, {X | Y | Z} CHARSIZE=value]
[, {X | Y | Z} GRIDSTYLE=integer{0 to 5}]
[, {X | Y | Z}MARGIN=[left, right]]
[, {X | Y | Z}MINOR=integer]
[, {X | Y | Z}RANGE=[min, max]]
[, {X | Y | Z}STYLE=value]
[, {X | Y | Z}THICK=value]
[, {X | Y | Z}TICKFORMAT=string]
[, {X | Y | Z}TICKINTERVAL= value]
[, {X | Y | Z}TICKLAYOUT=scalar]
[, {X | Y| Z}TICKLEN=value]
[, {X | Y | Z}TICKNAME=string_array]
[, {X | Y | Z}TICKS=integer]
[, {X | Y| Z}TICKUNITS=string]
[, {X | Y | Z}TICKV=array]
[, {X | Y | Z}TITLE=string]
Arguments
X
A vector (i.e., a one-dimensional array) of X coordinates.
Y
A vector of Y coordinates.
Z
A vector of Z coordinates. Z[i] is a function of X[i] and Y[i].
Keywords
AX
This keyword specifies the angle of rotation, about the X axis, in degrees towards the viewer. This keyword is effective only if !P.T3D is not set. If !P.T3D is set, the three-dimensional to two-dimensional transformation used by PLOT_3DBOX is taken from the 4 by 4 array !P.T.
The surface represented by the two-dimensional array is first rotated, AZ (see below) degrees about the Z axis, then by AX degrees about the X axis, tilting the surface towards the viewer (AX > 0), or away from the viewer.
The AX and AZ keyword parameters default to +30 degrees if omitted and !P.T3D is 0.
The three-dimensional to two-dimensional transformation represented by AX and AZ, can be saved in !P.T by including the SAVE keyword.
AZ
This keyword specifies the counterclockwise angle of rotation about the Z axis. This keyword is effective only if !P.T3D is not set. The order of rotation is AZ first, then AX.
GRIDSTYLE
Set this keyword to the linestyle index for the type of line to be used when drawing the gridlines. Linestyles are described in the following table:
Index |
Linestyle |
0 |
Solid |
1 |
Dotted |
2 |
Dashed |
3 |
Dash Dot |
4 |
Dash Dot Dot |
5 |
Long Dashes |
PSYM
Set this keyword to a plotting symbol index to be used in plotting the data. For more information, see PSYM.
SOLID_WALLS
Set this keyword to cause the boundary “walls” of the plot to be filled with the color index specified by the COLOR keyword.
XY_PLANE
Set this keyword to plot the X and Y values on the Z=0 axis plane.
XYSTYLE
Set this keyword to the linestyle used to draw the XY plane plot. See the table above for a list of linestyles.
XZ_PLANE
Set this keyword to plot the Y and Z values on the Y=MAX(Y) axis plane.
XZSTYLE
Set this keyword to the linestyle used to draw the XZ plane plot. See the table above for a list of linestyles.
YZ_PLANE
Set this keyword to plot the Y and Z values on the X=MAX(X) axis plane.
YZSTYLE
Set this keyword to the linestyle used to draw the YZ plane plot. See the table above for a list of linestyles.
ZAXIS
This keyword specifies the placement of the Z axis for the PLOT_3DBOX plot.
By default, PLOT_3DBOX draws the Z axis at the upper left corner of the axis box. To suppress the Z axis, use ZAXIS=-1 in the call. The position of the Z axis is determined from the value of ZAXIS as follows: 1 = lower right, 2 = lower left, 3 = upper left, and 4 = upper right.
Version History
See Also
PLOT, PLOTS Procedure, SURFACE Procedure