TABLE OF CONTENTS


::pwtk::heatmap

SYNOPSIS

proc ::pwtk::heatmap {args} {    

USAGE

    ::pwtk::heatmap  ?OPTIONS?  DATAFN

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

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

OPTIONS

Options specific for heatmaps:

General options:

ARGUMENT

PURPOSE

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

If the datafile was created with the ::pwtk::write command, it is closed prior to being plotted.

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   heatmap-[file rootname $args]
        set datafn [squote $args]
    } else {
        # lastarg is a function
        set id [incr ::pwtk::gp::heatmap_id]
        set head   heatmap-$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 nosurf}
    set with [concat w $opt(w) $opt(clw)]

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

    # add options + add excerpts

    ::pwtk::splotOptionsAdd_
    
    # plot
    
    if { $opt(contour) } {
        $gp plot [concat $datafn $opt(u), $datafn $opt(u) $with]
    } else {
        $gp plot [concat $datafn $opt(u)]
    }
    $gp exec    
    set output [$gp outputs]
    $gp destroy
    
    displayPlots_ $opt(v) $opt(t) $output
    
    return $output
}