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

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:

* 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]                
}