diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-07-16 19:36:34 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-07-16 19:36:34 (GMT) |
commit | b7ccffe6210332d49d3b19eafcbec0b0bf49e507 (patch) | |
tree | 3f436e6bb6a57ac8ed1b1a7963138ec61a71e26a /ds9 | |
parent | 001b796515d46ec7ef8a215cbf09bb4e0069c5e9 (diff) | |
download | blt-b7ccffe6210332d49d3b19eafcbec0b0bf49e507.zip blt-b7ccffe6210332d49d3b19eafcbec0b0bf49e507.tar.gz blt-b7ccffe6210332d49d3b19eafcbec0b0bf49e507.tar.bz2 |
support multiple graphs per plot
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/plot.tcl | 46 | ||||
-rw-r--r-- | ds9/library/plotstate.tcl | 2 |
2 files changed, 32 insertions, 16 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index 79aef19..62afc08 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -125,6 +125,7 @@ proc PlotLayoutCanvas {varname} { } # Graph +# used by backup proc PlotAddGraph {varname} { upvar #0 $varname var global $varname @@ -710,12 +711,6 @@ proc PlotBackup {ch dir} { if {[string range $ww 0 1] == {ap}} { set fdir [file join $dir $ww] - set varname $ww - upvar #0 $varname var - global $varname - - set cc $var(graph,current) - # create dir if needed if {![file isdirectory $fdir]} { if {[catch {file mkdir $fdir}]} { @@ -724,24 +719,45 @@ proc PlotBackup {ch dir} { } } + set varname $ww + upvar #0 $varname var + global $varname + + set cc $var(graph,current) switch $var($cc,type) { line {puts $ch "PlotLineTool"} bar {puts $ch "PlotBarTool"} scatter {puts $ch "PlotScatterTool"} } - set save $var(graph,ds,current) - foreach nn $var($cc,dss) { - set var(graph,ds,current) $nn - PlotCurrentDataSet $varname + set gr $var(graph,current) + set ds $var(graph,ds,current) + + set first 1 + foreach cc $var(graphs) { + set var(graph,current) $cc + PlotCurrentGraph $varname + if {!$first} { + puts $ch "PlotAddGraph $varname" + } + set first 0 - PlotSaveDataFile $varname "$fdir/plot$nn.dat" - PlotSaveConfigFile $varname "$fdir/plot$nn.plt" + foreach nn $var($cc,dss) { + set var(graph,ds,current) $nn + PlotCurrentDataSet $varname - puts $ch "PlotLoadDataFile $varname $fdir/plot$nn.dat $var($cc,$nn,dim)" - puts $ch "PlotLoadConfigFile $varname $fdir/plot$nn.plt" + PlotSaveDataFile $varname "$fdir/graph${cc}ds${nn}.dat" + PlotSaveConfigFile $varname "$fdir/graph${cc}ds${nn}.plt" + + puts $ch "PlotLoadDataFile $varname $fdir/graph${cc}ds${nn}.dat $var($cc,$nn,dim)" + puts $ch "PlotLoadConfigFile $varname $fdir/graph${cc}ds${nn}.plt" + } } - set ${varname}(graph,ds,current) $save + + set var(graph,current) $gr + PlotCurrentGraph $varname + + set var(graph,ds,current) $ds PlotCurrentDataSet $varname } } diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl index 362e35f..9fff7a3 100644 --- a/ds9/library/plotstate.tcl +++ b/ds9/library/plotstate.tcl @@ -9,7 +9,7 @@ proc PlotDefState {} { global pap # per Canvas - set pap(layout) column + set pap(layout) grid set pap(background) white set pap(bar,mode) normal |