Plot/Shape

From J Wiki
Jump to navigation Jump to search
Plot | Verbs | Class Commands Data Options Outputs Types | Colors Fonts Keys Text YAxes | Function Multi Shape

The sub plot command takes a parameter in one of three forms:

  • window
  • shape
  • sizes

A window parameter is the 4 numbers: xy of the bottom left corner, xy of the upper right corner. This creates a single subwindow of this size.

A position with an x suffix is in drawing units (pixels if output to screen). For example, a window of 0 0 100x 200x is the lower left 100 x 200 pixels.

A negative position counts from the end, offset by 1, so that -101x -201x -1x -1x is the 100 x 200 pixels at the top right corner.

For example, create a new sub plot window with xy position 100 100, and of size 400 by 600:

pd 'sub 100 100 500 700'

A shape parameter is the two numbers: rows, columns. This sets up an array of plots using equal divisions of the current window for each element of the shape.

For example:

pd 'sub 2 4'

will create an array of two equal depth rows and four equal width columns.

A sizes parameter is the lists, separated by comma: relative size of each row, relative size of each column. This creates an array of plots of the given relative sizes.

For example:

pd 'sub 2 1, 1 2 3 4'

will give an array in which the first row is twice the height of the second, and in which the columns have widths in ratio 1 to 2 to 3 to 4. Note that the comma acts as a separator in the string.

Subsequent Commands

After subwindows are created, subsequent commands new, use, sub, multi are relative to each subwindow in ravel order.

For example, the following creates a 2 by 3 array of subwindows, then draws plots in each. The second and last plots are blank.

pd 'sub 2 3'
pd 'new'
pd {options}
pd {data}
pd 'use'
pd 'use'
pd {options}
pd {data}
pd 'use'
pd {options}
pd {data}
pd 'use'
pd {options}
pd {data}
pd 'endsub'