TABLE OF CONTENTS


plot::options

SYNOPSIS

    method options {arr_set_list} {

USAGE

   $obj options {
      option1 value1
      option2 value2
      ...
   }

PURPOSE

Set options for Gnuplot. To explain the syntax of "option value" pairs, consider the following Gnuplot snippet:

       set xlabel "Distance (Bohr)"
       set ylabel 'Energy (Ry)'
       set format x '%3.1f'
       set format y '%3.1f'

This snippet is specified as:

     $obj options {
        xlabel {"Distance (Bohr)"}
        ylabel {'Energy (Ry)'}
        format.x '%3.1f'
        format.y '%3.1f'
     }

BEWARE

If the value consists of double-quotes or more than one field, it needs to be grouped with curly braces!

REMARK

PWTK will sort the options according to PWTK's preset order of options.

SOURCE

        if { ! $options_initiated } {
            foreach name $::pwtk::gp::known_options {
                if { [info exists my_options($name)] } {
                    set arr($name) $my_options($name)
                }
            }
            set options_initiated 1
            set options_list $::pwtk::gp::known_options
        }

        # we want the options sorted according to $::pwtk::gp::known_options

        foreach {name value} $arr_set_list {
            set arr($name) $value
            
            if { $name ni $options_list } {
                # unknown (i.e. new) option: let's add it to the list of known options
                lappend options_list $name
            }
        }

        foreach elem $options_list {
            ::pwtk::ifnotempty arr($elem) {
                # PWTK-->Gnuplot (e.g. format.x --> format x)
                set opt [split $elem .]
                append content "set $opt $arr($elem)\n"
            }
        }        
        append content \n
    }