Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: pgplotwidget - Constructor Up: plotter - Module Previous: pgplotmanager.addredrawfunction - Function


pgplotwidget - Tool



Package display
Module plotter


Postscript file available

tool used in application development to embed a pgplot canvas into some GUI

include "pgplotwidget.g"

Constructors
pgplotwidget Create a pgplot widget in a supplied frame
Functions
activatecallback activate a callback
addredrawfunction Add a function to redraw a command in the displaylist
canplay return whether a command can be executed
clear empty the display list
curs Get a key and position
cursor Set the cursor
deactivatecallback deactivate a callback
displaylist Access the displaylist plot commands are kept in
done destroy the widget, release resources
getcallbacks Recover callbacks
lastchange Version of the last change
maskline Draw line segments based on input vectors and a mask
message write in the message line
play Execute a series of plot commands
plotfile Save the plot in native format
plotxy Plot X,Y vectors as lines or points with auto-scaling
postscript Save the plot as a PostScript file
record Save the drawing commands
recording return whether plot commands are being saved
refresh replay the display list
resetplotnumber Reset internal plot number counter to 0
restore Retrieve a plot
setcallback set a function to be called for mouse or keyboard events
settings Set many PGPLOT attributes at once
shortnametofullname Get a longer description for pgplotwidget commands
size size in pixels of the pgplotwidget



Description
The pgplotwidget is a PGPLOT style widget to embed in a larger gui, such as pgplotter. It has a number of advantages over using a ``raw'' Glish/PGPLOT agent.
1.
It can automatically resize itself when it is resized.
2.
It can save its contents in a ``plot'' file, which can be opened and edited later (for example, by a User via pgplotter).
3.
It can save itself itself as postscript (colour or black and white, landscape or portrait).
4.
It has a one-line ``message'' window for status reports or instructions to the user.
5.
The architecture allows for ``higher level'' than PGPLOT commands to be added to the widget (either directly or via plugins). At the moment, we have implemented a settings function to allow you to set many PGPLOT defaults (line width, character height) at once, plotxy to allow you to conveniently plot x,y vectors with auto scaling, and a number of commands to emulate an old plotter gplot1d.

Except for the last two items, these advantages accrue by keeping a ``display'' list internally. That is, the commands sent to the widget are stored internally, and then when, e.g., the frame size is changed the list is replayed. This advantage comes at a cost of requiring more memory and slowing the display somewhat. Nevertheless, for most applications the advantages probably favor this approach.

One interesting capability is the ability to turn on and off the recording of plot commands. This allows you to ``lift'' drawings off one another. For example, you could interactively draw ellipses on the plot widget but not keep the ellipses in the display list, and then remove the ellipses by doing a refresh.

pgplotwidget features a zoom capability through the Middle Mouse Button (Button 2). Clicking on this and dragging the mouse opens up a zoom window; clicking again selects this as the zoom region, and redisplays. To unzoom, use CNTRL-Middle Mouse Button.

The pgplotwidget is built on top of the more generic pgplotmanager tool, which is in turn built on top of the Glish/PGPLOT client. Thus, almost all the basic drawing and inquiry commands described in the Glish/PGPLOT section of the Glish manual are available in the pgplotwidget. Calling these commands is different, though: instead of using the event operator, ->, one uses the normal . for accessing tool functions.

Only those functions that add functionality beyond that of the Glish pgplot agent are described explicitly in this reference manual section, specifically:

1.
Refreshing the screen (e.g. when the frame resizes).
2.
Saving and restoring to and from files.
3.
Instead of registering ``whenever'' statements for interactions (e.g., button pushes) you register callback functions.
4.
Standard PGPLOT curs() emulation.
5.
General manipulation of the displaylist.
6.
A ``done'' function for cleanup.
7.
A one line message window.
8.
A function for changing many settings (e.g. line width) at once.

Note that the pgplotwidget requires no AIPS++ binaries, so that including it in a non-AIPS++ Glish application is not ``expensive'' in startup time.

The following standard PGPLOT commands are described in the Glish manual:

arro
- draw an arrow
ask
- control new page prompting
bbuf
- begin batch of output (buffer)
beg
- begin PGPLOT, open output device
bin
- histogram of binned data
box
- draw labeled frame around viewport
circ
- draw a filled or outline circle
clos
- close the selected graphics device
conb
- contour map of a 2D data array, with blanking
conl
- label contour map of a 2D data array
cons
- contour map of a 2D data array (fast algorithm)
cont
- contour map of a 2D data array (contour-following)
ctab
- install the color table to be used by PGIMAG
draw
- draw a line from the current pen position to a point
ebuf
- end batch of output (buffer)
end
- terminate PGPLOT
env
- set window and viewport and draw labeled frame
eras
- erase all graphics from current page
errb
- horizontal or vertical error bar
errx
- horizontal error bar
erry
- vertical error bar
gray
- gray-scale map of a 2D data array
hi2d
- cross-sections through a 2D data array
hist
- histogram of unbinned data
iden
- write username, date, and time at bottom of plot
imag
- color image from a 2D data array
lab
- write labels for x-axis, y-axis, and top of plot
ldev
- list available device types
len
- find length of a string in a variety of units
line
- draw a polyline (curve defined by line-segments)
move
- move pen (change current pen position)
mtxt
- write text at position relative to viewport
numb
- convert a number into a plottable character string
open
- open a graphics device
page
- advance to new page
panl
- switch to a different panel on the view surface
pap
- change the size of the view surface
pixl
- draw pixels
pnts
- draw one or more graph markers, not all the same
poly
- fill a polygonal area with shading
pt
- draw one or more graph markers
ptxt
- write text at arbitrary position and angle
qah
- inquire arrow-head style
qcf
- inquire character font
qch
- inquire character height
qci
- inquire color index
qcir
- inquire color index range
qcol
- inquire color capability
qcr
- inquire color representation
qcs
- inquire character height in a variety of units
qfs
- inquire fill-area style
qhs
- inquire hatching style
qid
- inquire current device identifier
qinf
- inquire PGPLOT general information
qitf
- inquire image transfer function
qls
- inquire line style
qlw
- inquire line width
qpos
- inquire current pen position
qtbg
- inquire text background color index
qtxt
- find bounding box of text string
qvp
- inquire viewport size and position
qvsz
- find the window defined by the full view surface
qwin
- inquire window boundary coordinates
rect
- draw a rectangle, using fill-area attributes
rnd
- find the smallest `round' number greater than x
rnge
- choose axis limits
sah
- set arrow-head style
save
- save PGPLOT attributes
unsa
- restore PGPLOT attributes
scf
- set character font
sch
- set character height
sci
- set color index
scir
- set color index range
scr
- set color representation
scrn
- set color representation by name
sfs
- set fill-area style
shls
- set color representation using HLS system
shs
- set hatching style
sitf
- set image transfer function
slct
- select an open graphics device
sls
- set line style
slw
- set line width
stbg
- set text background color index
subp
- subdivide view surface into panels
svp
- set viewport (normalized device coordinates)
swin
- set window
tbox
- draw frame and write (DD) HH MM SS.S labelling
text
- write text (horizontal, left-justified)
updt
- update display
vect
- vector map of a 2D data array, with blanking
vsiz
- set viewport (inches)
vstd
- set standard (default) viewport
wedg
- annotate an image plot with a wedge
wnad
- set window and adjust viewport to same aspect ratio




next up previous contents index
Next: pgplotwidget - Constructor Up: plotter - Module Previous: pgplotmanager.addredrawfunction - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15