Plot/Commands
Plot | Verbs | Class Commands Data Options Outputs Types | Colors Fonts Keys Text YAxes | Function Multi Shape
Summary
reset reset plot sub,endsub create sub window. All plots are drawn in sub windows. If there is no sub command, the sub window is taken to be the full plot area. new,multi start plot definition. new starts a single plot, multi starts a multiplot. use set the current plotting area. rule,text,textc,textr draw rule and text show,isi,eps,pdf,pdfr,canvas,canvasr,cairo,cairor create and output plot save,get,clip,print copy plot to file, data stream, clipboard, printer
Drawing Commands
reset [parent] reset plot with optional parent window id.
For example:
pd 'reset'
sub shape, endsub. Command sub starts a sub plot with given shape, sets plot defaults. Used for creating one or more plot windows. If sub is not used, the plot window is the available area.
The command is recursive - each call to sub starts a new sub plot in the existing window. Use command endsub to end a sub plot and return to the previous window.
For an isigraph plot, the default window is the full area of the isigraph control, which itself defaults to 480 x 360 pixels. For EPS and PDF plots, the default window depends on whether there is an active isigraph window displaying the current plot. If so, the window size is the same as the isigraph window, otherwise it is 0 0 480 360.
For example, create a new sub plot window with xy position 100 100, and of size 400 by 600:
pd 'sub 100 100 400 600'
multi shape starts a multiplot with the given shape. See Multi plots.
new [window] starts a new plot with an optional window definition, sets plot defaults. Use to set initial values, and when displaying multiple plots within the current sub window.
use window change window, leaving option settings unchanged. This does not restore plot defaults.
To draw several plots using the same options to a single sub window, start with pd 'new' for the first plot, and then pd 'use' for the subsequent plots.
[options] sets plot options. See plot Options.
For example:
pd 'backcolor white; frame 1'
[data] sets plot data. See plot Data.
For example:
pd */~i:20
rule arg draw line.
text, textc, textr arg text left aligned, centered, right aligned.
Argument is x y text, where x y are coordinates relative to the current window.
For example, the following writes the text "J Graphics" centered at position 500 950:
pd 'textc 500 950 J Graphics'
See also Text commands.
Output commands
show [opts] display plot using the default output.
Output is isigraph in Jwdw or Jwdp, or GTK in JGTK, or canvas in JHS, or qt in QTIDE, otherwise PDF or cairo.
eps [file w h] (J6 only) display plot in EPS format.
The file defaults to ~temp/plot.eps. The [w h] is the EPS bounding box size, and defaults to the active plot window size in pixels, or 480 360 if none.
gtk (J7 only) display plot in a GTK window, where supported, requires GTK addon.
isi [w h] (J6 only) display plot in an isigraph window.
The [w h] are the pixels, and default to 480 360.
pdf [file w h] display plot in PDF format.
The file defaults to ~temp/plot.pdf. The [w h] is the PDF bounding box size, and defaults to the active plot window size in pixels, or 480 360 if none.
pdfr [w h] return plot as PDF stream.
The [w h] are the same as for pdf.
canvas [file w h context] (J7 or later) display plot in HTML5 canvas element format.
The file defaults to ~temp/plot.html. The [w h] is the canvas bounding box size, and defaults to the active plot window size in pixels, or 400 200 if none. The [context] is a name for identifying the canvas element, only 2 javascript function will be returned if this option is set.
canvasr [w h context] (J7 or later) return plot as HTML5 canvas element stream.
The [w h context] are the same as for canvas.
cairo [file w h] (J7 only) return plot in png format.
The file defaults to ~temp/plot.png. The [w h] is the image bounding box size, and defaults to the active plot window size in pixels, or 400 200 if none.
cairor [w h] (J7 only) return plot as png stream.
The [w h] are the same as for cairo.
qt [w h] (J8 only) display plot in a QT window, where supported, requires QT addon.
The [w h] are the pixels, and default to 480 360.
qtc [file w h] (J803 or later) return plot in image format, requires QT addon. This also works under jconsole (Linux requires X-Window).
The file defaults to ~temp/plot.png. The [w h] are the pixels, and default to 480 360.
See also Outputs.
Copy commands
The following commands copy an isigraph window, and require that an isigraph plot has already been created. To execute one of the copy commands silently, without first displaying the isigraph window, set the Plot option visible to 0. Note that generating an isigraph window uses the gl2 commands that are built into Jwd but not Jconsole. For this reason, it is not currently possible to use the copy commands from a Jconsole session.
clip copy isigraph plot to clipboard.
print print isigraph plot.
save type [options] save isigraph plot to file.
The save command supports several image types/formats. For J6, those marked with an asterisk(*) require that the platimg addon be installed. In each case, a file name is optional. If not given, the file is ~temp/plot.ext, where ext is the file type. For example, the default bmp file is ~temp/plot.bmp.
- save bmp [file] [w h] save isigraph plot as a bitmap file. The [w h] is the bitmap size, and defaults to the current displayed plot size.
- save emf [file] save isigraph plot to file in emf format.
- save jpg [file|quality]* save isigraph plot to file in jpeg format. The quality is a percentage, and defaults to 100 (highest quality).
- save png [file|compression]* save isigraph plot to file in png format. The compression is a number from 0 to 9, and defaults to 9 (highest compression).
- save gif [file]* save isigraph plot to file in gif format.
- save tif [file]* save isigraph plot to file in tif format.
get type return isigraph plot as data stream.
The get command supports several image types/formats. For J6, those marked with an asterisk(*) require that the platimg addon be installed.
- get jpg* return isigraph plot as a data stream in jpeg format.
- get png* return isigraph plot as data stream in png format.
- get gif* return isigraph plot as data stream in gif format.
- get tif* return isigraph plot as data stream in tif format.