TABLE OF CONTENTS
::pwtk::multiplot
SYNOPSIS
proc ::pwtk::multiplot {args} {
USAGE
::pwtk::multiplot ?PLOTTING-OPTIONS? DATAFN_LIST1 ?DATAFN_LIST2? ... where DATAFN_LIST1, DATAFN_LIST2, ... are lists of datafiles or functions to plot.
PLOTTING OPTIONS
See ::pwtk::plot
ARGUMENTS
- DATAFN_LIST1 --- list of datafiles and/or functions to plot in the 1st plot
- DATAFN_LIST2 --- list of datafiles and/or functions to plot in the 2nd plot
- ...
PURPOSE
::pwtk::multiplot plots data as the multiplot. Each list of data (DATAFN_LIST) is plotted in a separate plot, i.e., DATAFN_LIST1 in plot-1, DATAFN_LIST2 in plot-2, etc.
If the datafiles were created with the ::pwtk::write command, they are closed prior to being plotted.
This is meant as a fast way of plotting multi-plots. For a more elaborate and configurable multi-plotting, use the ::pwtk::gp::multiplot object-oriented interface instead.
EXAMPLE
scanpar k [seq 2 2 8] { scanpar ecut [seq 10 4 30] { set head scf.k$k.ecut$ecut SYSTEM "ecutwfc = $ecut" K_POINTS (automatic) "$k $k $k 1 1 1" runPW $head write k.$k.dat [pwo_totene $head.out] } } # plot each datafile separately and also all of them together multiplot -xl "ecutwfc (Ry)" -yl "Total energy (Ry)" -u 2:3 \ k.2.dat k.4.dat k.6.dat k.8.dat { k.2.dat k.4.dat k.6.dat k.8.dat }
RETURN VALUE
- a list of created images (for file terminals)
- an empty string (for non-file terminals)
SOURCE
variable write_fid # parse args set arguments "DATAFN_LIST1 ?DATAFN_LIST2? ..." plotParseOpt_ ifnotempty opt(u) { set opt(u) "u $opt(u)" } ifset opt(xl) '' ifset opt(yl) '' # plot's name if { $opt(out) ne {} } { set head [headname $opt(out) .$opt(t)] } else { set id [incr ::pwtk::gp::multiplot_id] set head multiplot-$id } # plot finish [concat {*}$args] set nplot 0 foreach datafnList $args { foreach datafn $datafnList { if { [file exists $datafn] } { # datafn is a file set with [expr { $opt(w) eq {} ? $::pwtk::gp::gp(datafile_with) : $opt(w) }] append plot($nplot) "[squote $datafn] $opt(u) w $with, " } else { # datafn is a function, skip $opt(u) set with [expr { $opt(w) eq {} ? $::pwtk::gp::gp(function_with) : $opt(w) }] append plot($nplot) "$datafn w $with, " } } set plot($nplot) [string trim $plot($nplot) {, }] incr nplot } set gp [::pwtk::gp::multiplot new -o landscape -s $opt(s) auto $nplot $head.$opt(t)] $gp cmdlineOpts opt for {set i 0} {$i < $nplot} {incr i} { $gp plot $plot($i) } return [::pwtk::gp::execDisplay_ $gp opt] }