TABLE OF CONTENTS


::pwtk::heatmap

SYNOPSIS

proc ::pwtk::heatmap {args} {    

USAGE

   ::pwtk::heatmap  ?SPLOT-OPTIONS?  ?PLOTTING-OPTIONS?  DATAFN

   where DATAFN is either a datafile or a function to plot.

   For SPLOT-OPTIONS, see ::pwtk::splot.
   For PLOTTING-OPTIONS, see ::pwtk::plot.

SPLOT OPTIONS

See ::pwtk::splot (N.B. the -type option is ignored).

PLOTTING OPTIONS

See ::pwtk::plot

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

    # parse args
    ::pwtk::ignoredOpts_ -type $args
    set arguments "DATAFN"
    splotParseOpt_

    # plot's name

    if { $opt(out) ne {} } {
        set head [headname $opt(out) .$opt(t)]
    } else {
        if { [file exists $args] } {
            set head heatmap-[file tail [file rootname $args]]
        } else {
            set id [incr ::pwtk::gp::heatmap_id]
            set head heatmap-$id
        }
    }

    # datafile or function ?

    if { [file exists $args] } {
        # lastarg is a file
        finish $args
        set datafn [squote $args]
    } else {
        # lastarg is a function
        set datafn $args
    }

    # specific-options post-processing

    set gp [splotCreateConfigure_ map {l nosurf} opt $head]
    set with [concat w $opt(w) $opt(clw)]
    
    # plot
    
    if { $opt(contour) } {
        $gp plot [concat $datafn $opt(u), $datafn $opt(u) $with]
    } else {
        $gp plot [concat $datafn $opt(u)]
    }

    return [::pwtk::gp::execDisplay_ $gp opt]
}