TABLE OF CONTENTS
plot::constructor
SYNOPSIS
constructor {args} {
PURPOSE
Create a new single-plot Gnuplot object.
HOW TO USE
The 'plot' Gnuplot object is created as:
set obj [pwtk::gp::plot new ?OPTIONS? ?HEAD.TERM?]
where OPTIONS are:
-o ORIENT -s SX,SY -fs FONTSIZE -t TITLE -spin -p -pause PAUSE
ARGUMENTS
- OPTIONS --- see OPTIONS below
- HEAD.TERM --- (optional) "HEAD" is the rootname of gnuplot script; "TERM" is the type of terminal (PWTK's terminal name) and the file's extension if plot is printed to a file; possible values are those returned by ::pwtk::gp::pwtk_terminals; if the HEAD.TERM is omitted, a default window terminal is used and HEAD is set to "plot"
OPTIONS
- -o ORIENT --- page orientation (portrait or landscape); used explicitly only for EPS, while for other terminals, it's a hint for the multiplot layout
- -s SX,SY --- terminal size (i.e. window or picture size)
- -fs FONTSIZE --- font size
- -t TITLE --- the window title (for window-type terminals only)
- -spin --- spin-PDOS-like plots with positive & negative Y-values, f(x) & -f(x)
- -p --- signals that more than one single-plot will be plotted (for PNG-like terminals, the name of output image will be $head-$pageNumber.png)
- -pause PAUSE --- value for the Gnuplot's pause command (useful for window terminals)
RETURN VALUE
The Gnuplot single-plot object.
SOURCE
set options_initiated 0 array set my_options [array get ::pwtk::gp::options] set page 1; # N.B. page must be 1 for new_page to work correctly # parse command-line options/arguments set argsOrig $args set nargmin 0 set nargmax 1 set usage "new ?-p? ?-o ORIENT? ?-s SIZE? ?-fs FONTSIZE? ?-t TITLE? ?-pause PAUSE? ?-spin? ?HEAD.TERM?" ::pwtk::gp::parseOpt_term_ if { $args ne {} } { set head [::pwtk::gp::head_ $args] set term [::pwtk::gp::term_ $args] set args [lrange $argsOrig 0 end-1] } else { set id [incr ::pwtk::gp::plot_id] set head [::pwtk::gp::head_ plot-$id.win] set term [::pwtk::gp::term_ plot-$id.win] set args $argsOrig } # -pause my pause_ -1 $opt(pause) # specially handle the -t option set title {} if { $term in $::pwtk::gp::gp(win.terminals) } { if { $opt(p) == 0 } { set t [string trim "$opt(t) ($pauseText to Exit)"] } else { set t [string trim "$opt(t) ($pauseText to continue to next page)"] } set title [list -t $t] } set prolog [::pwtk::gp::get_term {*}$args {*}$title $head.$term]\n }