
--------- Image display
-- The "image" command can be used to display a 2D array. Each array element is displayed as a tile filled with a gray level (or color) corresponding to its value.

   A[ix,iy] = sin(ix*10) + sin(iy*10) dim[40,36]
   image A

-- The entire array is displayed and fills the plot area regardless of the values of Xmin, Xmax, Ymin, or Ymax. These values can be set as desired to show whatever axis is appropriate for the data.

   Xmin=0; Xmax=400; Ymin=0; Ymax=360;  -- Label axis in degrees
   Xdiv=90; Ydiv=90

-- The array is displayed "sideways" meaning that array element A[1,1] is displayed in the lower left corner. This convention results in a simple correspondence between an element A[ix,iy] and the plot x,y coordinate system.

-- The image command displays an array but any function can be converted to an array. To sample a function over some arbitrary range of x and y values you can scale array index values to generate the desired x and y values.


---------- Z scale
-- Mapping of an element's numeric value to a gray level (or color) is controlled by special variables "Zmin" and "Zmax". Zmin and Zmax define the range of values that are of interest. Values at or above Zmax are displayed as the highest gray level (or color). Values at or below Zmin are displayed as the lowest gray level (or color). Missing data is always displayed as white.

   Zmin=-2; Zmax =2;

---------- Auto ranging
-- If Zmin and/or Zmax are not specified, MathPad will use Zlo and/or Zhi from the previous evaluation. This is similar to the way plots are auto-ranged except that the user must re-evaluate the document to get the new Z scale. This was done because of the time involved in evaluating an array twice. It seemed best to give the user another chance at setting the scale before evaluating again.

---------  Printing images
-- Since your printer may not have the same capabilities as your screen, the image dialog is presented when you print a plot containing an image. Unless you have a color printer you will probably want to print the image as gray levels.

---------  Plot overlays
-- The plot command can be used in conjunction with the image command. The plot will be drawn on top of the image.

   plot sin(X)*50+200  -- arbitrary scale to fit on existing Y axis

---------  PICT overlays
-- A PICT pasted into the plot goes on top of the image. If the PICT is a line drawing the image will be visible through the PICT but a bitmap will obscure the entire image.

---------  Click info
-- When the mouse is clicked on the image the corresponding X,Y and Z values are printed in the info line at the bottom of the plot. Since only the display information is saved, the Z value shown is approximate and will not show values outside of Zmin to Zmax. If the image has a plot overlay the mouse click will pick a nearby plot X,Y point over an image point.

