TABLE OF CONTENTS


::pwtk::gp::new_page_multiplot

SYNOPSIS

proc ::pwtk::gp::new_page_multiplot {term pageNo mpName pauseValue {head {}}} {

PURPOSE

Get a Gnuplot snippet for a new page for a multiplot. Do not confuse it with ::pwtk::gp::new_page_plot that is used for single-plot.

Typically used internally by PWTK.

ARGUMENTS

SOURCE

    variable gp
    upvar $mpName mp
    
    if { ! [info exists mp] } {
        ::error "multiplot_array \"$mpName\" does not exists"
    }

    array set a [pause_ $pauseValue]    
    set term [pwtk2gp $term]

    if { $pageNo > 1 } {
        if { $term in $gp(file.terminals) || $term in $gp(txt.terminals) } {
            set clear "\nunset multiplot"
        } else {
            # case: $term in $gp(win.terminals)
            set clear "\npause $a(pause)\nunset multiplot"
        }
        set output "\nset output '[output $term $head $pageNo]'"
    } else {
        set clear  ""
        set output ""
    }
               
    if { $term in $gp(file.terminals) } {
        switch -- $term {
            pdfcairo - postscript {
                return "$clear
set multiplot layout $mp(ny),$mp(nx)
"
            }
            default {
                return "${clear}$output
set multiplot layout $mp(ny),$mp(nx)
"
            }
        }        
    } elseif { $term in $gp(win.terminals) } {
        if { $pageNo == $mp(pp) } {
            set title "Page $pageNo/$mp(pp)  ($a(pauseText) to Exit)"
        } else {
            set title "Page $pageNo/$mp(pp)  ($a(pauseText) to continue to next page)"
        }
        if  { $term ne {} } {
            # this does not work for empty, {}, window terminal
            return "$clear
set term $term title '$title'
set multiplot layout $mp(ny),$mp(nx) title '$title' font '$gp(font),$gp(fontSize)'
"
        } else {
            # empty terminal
            return "$clear
set multiplot layout $mp(ny),$mp(nx) title '$title'
"
        }
    } elseif { $term in $gp(txt.terminals) } {
        # txt and empty window terminal
        return "$clear
set multiplot layout $mp(ny),$mp(nx) title 'Page $pageNo/$mp(pp)'
"
    } else {
        ::pwtk::error "unsupported PWTK terminal \"$term\", must be one of [join $gp(terminals) {, }]" 1
    }
}