TABLE OF CONTENTS
::pwtk::gp::multiplot_array
SYNOPSIS
proc ::pwtk::gp::multiplot_array {nplot {np_in -1} {nx_in -1} {orient portrait} {spin {}}} {
PURPOSE
Set the multiplot data in the form of a Tcl array, i.e., set good values for pp, np, nx, ny, fsize for a given number of plots.
ARGUMENTS
- nplot --- number of plots in the multiplot
- np_in --- [optional] number of plots per page (overwrites defult for a given nplot)
- nx_in --- [optional] number of plots in X-dir (overwrites defult for a given nplot)
- orient --- [optional] orientation of the multiplot, either portrait or landscape
- spin --- [optional] spin-PDOS-like plots (empty string or 0 means no-spin)
RETURN VALUE
A list of names & values, suitable for "array set" command, in particular:
[list pp $pp np $np nx $nx ny $ny fsize $fsize]
Explantion of variables:
- pp = # of pages
- np = average # of plots per page
- nx = number of plots in X-dir (aka # columns)
- ny = number of plots in Y-dir (aka # rows)
- fsize = fontSize
* npmax = used along the way as auxiliary;
stands for maximum # of plots per page, e.g., nx*ny
SOURCE
variable gp variable gp_multi set npmax $np_in set nx $nx_in set fsize {} if { $spin eq {} || $spin == 0 } { set spinOrient $orient } else { set spinOrient spin.$orient } if { $np_in < 1 } { set npmax $gp($orient.npmax) } set np $nplot set pp [expr ($nplot-1)/$npmax + 1] if { $pp > 1 } { if { $nplot%$pp } { set np [expr $nplot/$pp + 1] } else { set np [expr $nplot/$pp] } } if { $np > $gp($spinOrient.np4) } { if { $nx < 0 } { set nx $gp($spinOrient.nx4) } set fsize $gp(fontSize.nx4) } elseif { $np > $gp($spinOrient.np3) } { if { $nx < 0 } { set nx $gp($spinOrient.nx3) } set fsize $gp(fontSize.nx3) } elseif { $np > $gp($spinOrient.np2) } { if { $nx < 0 } { set nx $gp($spinOrient.nx2) } set fsize $gp(fontSize.nx2) } elseif { $np > $gp($spinOrient.np1) } { if { $nx < 0 } { set nx $gp($spinOrient.nx1) } set fsize $gp(fontSize.nx1) } else { if { $nx < 0 } { set nx $gp($spinOrient.nx0) } set fsize $gp(fontSize.nx0) } # adjust the npmax if { $pp > 1 } { if { $np%$nx } { set npmax [expr $nx*($np/$nx + 1)] } else { set npmax $np } set ny [expr $npmax/$nx] } else { set npmax $nplot if { $nplot%$nx } { set ny [expr $nplot/$nx + 1] } else { set ny [expr $nplot/$nx] } } # adjust the np set np [format %.2f [expr double($nplot)/$pp]] return [list pp $pp np $np nx $nx ny $ny fsize $fsize] }