TABLE OF CONTENTS


::pwtk::splot

SYNOPSIS

proc ::pwtk::splot {args} {    

USAGE

   splot  ?OPTIONS?  DATAFN

 where DATAFN is either a datafile or a function to plot, and
 OPTIONS are:

    -type TYPE
    -pal  PALETTE
    -i    INTERPOLATION
    -contour
    -cc   CONTOUR_COLOR
    -clw  CONTOUR_LINEWIDTH
    -xl   XLABEL  
    -yl   YLABEL  
    -zl   ZLABEL  
    -xr   XRANGE  
    -yr   YRANGE  
    -zr   ZRANGE  
    -cbr  CBRANGE  
    -xf   XFORMAT 
    -yf   YFORMAT 
    -zf   ZFORMAT 
    -cbf  CBFORMAT 
    -u    USING    
    -w    WITH     
    -e    EXTRA    
    -t    TERMINAL 
    -v           

OPTIONS

Options specific for 3D surface plots:

General options:

ARGUMENT

PURPOSE

A fast way of making an splot from the x, y, f(x,y) tabulated data. For a more elaborate 3D plotting, use the ::pwtk::gp::splot object-oriented interface instead.

The PWTK's predefined color palettes can be accessed with the -pal option. To invert a palette, use "-pal {PALETTE negative}", where PALETTE is one of:

Note that for PALETTE only a substring that uniquely identifies it is required. For example, "-pal pa" selects the "pale-rainbow" palette.

RETURN VALUE

SOURCE

    variable write_fid
    variable plot_id

    # parse args

    set narg 1
    ::pwtk::splotParseOpt_
    
    # datafile or function ?

    if { [file exists $args] } {
        # lastarg is a file
        finish $args
        set head   splot-[file rootname $args]
        set datafn [squote $args]
    } else {
        # lastarg is a function
        set id [incr ::pwtk::gp::splot_id]
        set head   splot-$id
        set datafn $args
    }

    # options post-processing

    set opts ""
    ifnotempty opt(pal) { append opts "[list -pal $opt(pal)] " }
    ifnotempty opt(cc)  { append opts "[list -cc $opt(cc)] " }
    if { ! $opt(contour) } { append opts "-nocontour " }
    
    ifnotempty opt(clw) { set opt(clw) "lw $opt(clw)" }
    ifnotempty opt(u)   { set opt(u)   "u $opt(u)" }
    ifset opt(w) l 
    set with [concat w $opt(w) $opt(clw)]

    # create Gnuplot splot object

    set gp [::pwtk::gp::splot new -type $opt(type) {*}$opts $head.$opt(t)]

    # add options + add excerpts

    ::pwtk::splotOptionsAdd_

    # plot
    
    $gp plot [concat $datafn $opt(u) $with]
    $gp exec    
    set output [$gp outputs]
    $gp destroy
    
    displayPlots_ $opt(v) $opt(t) $output
    
    return $output
}