summaryrefslogtreecommitdiffstats
path: root/ds9/library
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-05-24 21:21:36 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-05-24 21:21:36 (GMT)
commitd180078a75bf8d0b3090d564dbdb48d79ba43947 (patch)
tree20e6921486c1eb0b8e87276cfe4785cd76101568 /ds9/library
parentecfba834a6bbe38a4994f364c805f8305e1b7c5f (diff)
downloadblt-d180078a75bf8d0b3090d564dbdb48d79ba43947.zip
blt-d180078a75bf8d0b3090d564dbdb48d79ba43947.tar.gz
blt-d180078a75bf8d0b3090d564dbdb48d79ba43947.tar.bz2
add strip plot support
Diffstat (limited to 'ds9/library')
-rw-r--r--ds9/library/catplot.tcl2
-rw-r--r--ds9/library/markeranalysispanda.tcl2
-rw-r--r--ds9/library/plot.tcl95
-rw-r--r--ds9/library/plotbar.tcl4
-rw-r--r--ds9/library/plotdialog.tcl4
-rw-r--r--ds9/library/plotline.tcl4
-rw-r--r--ds9/library/plotprint.tcl163
-rw-r--r--ds9/library/plotprocess.tcl14
-rw-r--r--ds9/library/plotscatter.tcl22
9 files changed, 164 insertions, 146 deletions
diff --git a/ds9/library/catplot.tcl b/ds9/library/catplot.tcl
index 9072745..567da52 100644
--- a/ds9/library/catplot.tcl
+++ b/ds9/library/catplot.tcl
@@ -86,7 +86,7 @@ proc CATPlotGenerate {varname} {
set var(plot,var) $vvarname
}
- PlotClearData $vvarname
+ PlotDeleteData $vvarname
PlotDataSet $vvarname $dim $rr
PlotTitle $vvarname $var(title) $xtitle $ytitle
$vvar(proc,updategraph) $vvarname
diff --git a/ds9/library/markeranalysispanda.tcl b/ds9/library/markeranalysispanda.tcl
index ec8f36e..d60b158 100644
--- a/ds9/library/markeranalysispanda.tcl
+++ b/ds9/library/markeranalysispanda.tcl
@@ -103,7 +103,7 @@ proc MarkerAnalysisPandaCB {frame id} {
MarkerAnalysisPandaAxisTitle $vvarname
}
- PlotClearData $vvarname
+ PlotDeleteData $vvarname
PlotDataSet $vvarname 3 [$frame get marker $id analysis panda $sys]
$vvar(proc,updategraph) $vvarname
PlotStats $vvarname
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 343a954..445a970 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -118,15 +118,13 @@ proc PlotAddGraph {varname} {
$var(proc,addgraph) $varname
- set var(graph) $var(graph$cc)
- set var(type) $var(type$cc)
-
# set up zoom stack, assuming mode is zoom
global ds9
switch $ds9(wm) {
x11 -
- win32 {Blt_ZoomStack $var(graph) -mode release}
- aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"}
+ win32 {Blt_ZoomStack $var(graph$cc) -mode release}
+ aqua {Blt_ZoomStack $var(graph$cc) -mode release \
+ -button "ButtonPress-2"}
}
PlotLayoutCanvas $varname
@@ -142,10 +140,6 @@ proc PlotDeleteGraph {varname} {
incr ${varname}(graph,total) -1
incr ${varname}(graph,current) -1
-
- set cc $var(graph,current)
-
- set var(graph) $var(graph$cc)
}
}
@@ -158,29 +152,30 @@ proc PlotAddData {varname} {
set cc $var(graph,current)
# warning: uses current vars
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
# delete current elements
set nn $var(graph$cc,data,current)
- foreach el [$var(graph) element names] {
+ foreach el [$var(graph$cc) element names] {
set f [split $el -]
if {[lindex $f 1] == $nn} {
- $var(graph) element delete $el
+ $var(graph$cc) element delete $el
}
}
global $var(xdata) $var(ydata)
- $var(graph) element create "d-${nn}" -xdata $var(xdata) -ydata $var(ydata)
+ $var(graph$cc) element create "d-${nn}" \
+ -xdata $var(xdata) -ydata $var(ydata)
if {$var(xedata) != {}} {
if {[$var(xedata) length] != 0} {
- $var(graph) element configure "d-${nn}" -xerror $var(xedata)
+ $var(graph$cc) element configure "d-${nn}" -xerror $var(xedata)
}
}
if {$var(yedata) != {}} {
if {[$var(yedata) length] != 0} {
- $var(graph) element configure "d-${nn}" -yerror $var(yedata)
+ $var(graph$cc) element configure "d-${nn}" -yerror $var(yedata)
}
}
}
@@ -196,16 +191,19 @@ proc PlotChangeMode {varname} {
upvar #0 $varname var
global $varname
- global ds9
+ set tt $var(graph,total)
+ set cc $var(graph,current)
- switch $var(mode) {
- pointer {
- blt::RemoveBindTag $var(graph) zoom-$var(graph)
- bind $var(graph) <1> [list PlotButton $varname %x %y]
- }
- zoom {
- bind $var(graph) <1> {}
- blt::AddBindTag $var(graph) zoom-$var(graph)
+ for {set ii 1} {$ii<=$tt} {incr ii} {
+ switch $var(mode) {
+ pointer {
+ blt::RemoveBindTag $var(graph$ii) zoom-$var(graph$ii)
+ bind $var(graph$ii) <1> [list PlotButton $varname %x %y]
+ }
+ zoom {
+ bind $var(graph$ii) <1> {}
+ blt::AddBindTag $var(graph$ii) zoom-$var(graph$ii)
+ }
}
}
}
@@ -219,20 +217,20 @@ proc PlotDeleteData {varname} {
set tt $var(graph,total)
set cc $var(graph,current)
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
# first set can be external
set clear $var(1,manage)
- for {set nn 1} {$nn<=$tt} {incr nn} {
+ for {set nn 1} {$nn<=$var(graph$cc,data,total)} {incr nn} {
if {$var($nn,manage)} {
# delete elements
- foreach el [$var(graph) element names] {
+ foreach el [$var(graph$cc) element names] {
set f [split $el -]
if {[lindex $f 1] == $nn} {
- $var(graph) element delete $el
+ $var(graph$cc) element delete $el
}
}
@@ -297,7 +295,7 @@ proc PlotCurrentData {varname} {
set tt $var(graph,total)
set cc $var(graph,current)
- if {$tt > 0} {
+ if {$var(graph$cc,data,total) > 0} {
set nn $var(graph$cc,data,current)
set var(manage) $var($nn,manage)
@@ -376,7 +374,7 @@ proc PlotDataSetOne {varname dim data} {
# basics xy
set var(manage) 1
- set var(name) "Data Set $nn"
+ set var(name) "Dataset $nn"
set var(xdata) $xdata
set var(ydata) $ydata
global $var(xdata) $var(ydata)
@@ -557,7 +555,7 @@ proc PlotDupData {varname mm} {
set tt $var(graph,total)
set cc $var(graph,current)
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
@@ -567,7 +565,7 @@ proc PlotDupData {varname mm} {
set pp [expr $nn-1]
# new vector names
- set var($nn,name) "Data Set $nn"
+ set var($nn,name) "Dataset $nn"
set var($nn,xdata) ap${varname}xx${nn}
set var($nn,ydata) ap${varname}yy${nn}
set var($nn,xedata) ap${varname}xe${nn}
@@ -646,7 +644,7 @@ proc PlotDestroy {varname} {
return
}
- for {set nn 1} {$nn<=$tt} {incr nn} {
+ for {set nn 1} {$nn<=$var(graph$cc,data,total)} {incr nn} {
switch $var($nn,dim) {
xy {
blt::vector destroy $var($nn,xdata) $var($nn,ydata)
@@ -700,7 +698,7 @@ proc PlotExternal {varname} {
set nn $var(graph$cc,data,total)
set var(graph$cc,data,current) $nn
- set var(name) "Data Set $nn"
+ set var(name) "Dataset $nn"
set var($nn,manage) $var(manage)
set var($nn,dim) $var(dim)
@@ -714,7 +712,7 @@ proc PlotExternal {varname} {
# update data set menu
$var(mb).graph.select add radiobutton \
- -label "[msgcat::mc {Data Set}] $nn" \
+ -label "[msgcat::mc {Dataset}] $nn" \
-variable ${varname}(graph$cc,data,current) -value $nn \
-command "PlotCurrentData $varname"
@@ -1177,6 +1175,9 @@ proc PlotUpdateGraph {varname} {
upvar #0 $varname var
global $varname
+ set tt $var(graph,total)
+ set cc $var(graph,current)
+
global ds9
if {$var(axis,x,auto)} {
@@ -1195,23 +1196,23 @@ proc PlotUpdateGraph {varname} {
set ymax $var(axis,y,max)
}
- $var(graph) xaxis configure -min $xmin -max $xmax \
+ $var(graph$cc) xaxis configure -min $xmin -max $xmax \
-descending $var(axis,x,flip)
- $var(graph) yaxis configure -min $ymin -max $ymax \
+ $var(graph$cc) yaxis configure -min $ymin -max $ymax \
-descending $var(axis,y,flip)
if {$var(graph,format)} {
if {$var(axis,x,format) != {}} {
- $var(graph) xaxis configure \
+ $var(graph$cc) xaxis configure \
-command [list PlotAxisFormat $varname x]
} else {
- $var(graph) xaxis configure -command {}
+ $var(graph$cc) xaxis configure -command {}
}
if {$var(axis,y,format) != {}} {
- $var(graph) yaxis configure \
+ $var(graph$cc) yaxis configure \
-command [list PlotAxisFormat $varname y]
} else {
- $var(graph) yaxis configure -command {}
+ $var(graph$cc) yaxis configure -command {}
}
}
@@ -1238,26 +1239,26 @@ proc PlotUpdateGraph {varname} {
}
# Graph
- $var(graph) configure -plotpadx 0 -plotpady 0 \
+ $var(graph$cc) configure -plotpadx 0 -plotpady 0 \
-title $var(graph,title) \
-font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" \
-bg $var(graph,bg) -plotbackground $var(graph,bg)
- $var(graph) xaxis configure \
+ $var(graph$cc) xaxis configure \
-bg $var(graph,bg) \
-grid $var(axis,x,grid) -logscale $var(axis,x,log) \
-title $var(axis,x,title) \
-tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
-titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
- $var(graph) yaxis configure \
+ $var(graph$cc) yaxis configure \
-bg $var(graph,bg) \
-grid $var(axis,y,grid) -logscale $var(axis,y,log) \
-title $var(axis,y,title) \
-tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
-titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
- $var(graph) legend configure -hide [expr !$var(legend)] \
+ $var(graph$cc) legend configure -hide [expr !$var(legend)] \
-bg $var(graph,bg) \
-position $var(legend,position) -title $var(legend,title) \
-font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \
@@ -1359,7 +1360,7 @@ proc PlotBackup {ch dir} {
}
}
- switch $var(type) {
+ switch $var(graph$cc,type) {
line {puts $ch "PlotLineTool"}
bar {puts $ch "PlotBarTool"}
scatter {puts $ch "PlotScatterTool"}
@@ -1367,7 +1368,7 @@ proc PlotBackup {ch dir} {
}
set save $var(graph$cc,data,current)
- for {set ii 1} {$ii<=$tt} {incr ii} {
+ for {set ii 1} {$ii<=$var(graph$cc,data,total)} {incr ii} {
set ${varname}(graph$cc,data,current) $ii
PlotCurrentData $varname
diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl
index ad49e95..109d6a5 100644
--- a/ds9/library/plotbar.tcl
+++ b/ds9/library/plotbar.tcl
@@ -166,7 +166,7 @@ proc PlotBarUpdateElement {varname} {
set cc $var(graph,current)
# warning: uses current vars
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
@@ -185,7 +185,7 @@ proc PlotBarUpdateElement {varname} {
set cap 0
}
- $var(graph) element configure "d-${nn}" \
+ $var(graph$cc) element configure "d-${nn}" \
-label $var(name) -hide [expr !$var(show)] \
-relief $var(bar,relief) -color $var(color) \
-showerrorbars $show -errorbarcolor $var(error,color) \
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index a843179..78a05e1 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -166,7 +166,7 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
# Graph
menu $var(mb).graph
- $var(mb).graph add cascade -label [msgcat::mc {Select Data Set}] \
+ $var(mb).graph add cascade -label [msgcat::mc {Select Dataset}] \
-menu $var(mb).graph.select
$var(mb).graph add separator
menu $var(mb).graph.select
@@ -489,7 +489,7 @@ proc DatasetNameDialog {varname} {
# Param
set f [ttk::frame $w.param]
- ttk::label $f.label -text [msgcat::mc {Data Set Name}]
+ ttk::label $f.label -text [msgcat::mc {Dataset Name}]
ttk::entry $f.name -textvariable ed(name) -width 30
grid $f.label $f.name -padx 2 -pady 2 -sticky ew
diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl
index 44f71f2..e5b0a05 100644
--- a/ds9/library/plotline.tcl
+++ b/ds9/library/plotline.tcl
@@ -230,7 +230,7 @@ proc PlotLineUpdateElement {varname} {
set cc $var(graph,current)
# warning: uses current vars
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
@@ -267,7 +267,7 @@ proc PlotLineUpdateElement {varname} {
set cap 0
}
- $var(graph) element configure "d-${nn}" \
+ $var(graph$cc) element configure "d-${nn}" \
-label $var(name) -hide [expr !$var(show)] \
-symbol $var(shape,symbol) -fill $clr -scalesymbols no \
-pixels 5 -outline $var(shape,color) \
diff --git a/ds9/library/plotprint.tcl b/ds9/library/plotprint.tcl
index 8d6c98c..1407c6a 100644
--- a/ds9/library/plotprint.tcl
+++ b/ds9/library/plotprint.tcl
@@ -19,101 +19,106 @@ proc PlotPostScript {varname} {
upvar #0 $varname var
global $varname
+ set tt $var(graph,total)
+ set cc $var(graph,current)
+
global ps
global ds9
- # set postscript fonts
- $var(graph) configure \
- -font "$var(graph,title,family) $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)"
+ for {set ii 1} {$ii<=$tt} {incr ii} {
+ # set postscript fonts
+ $var(graph$ii) configure \
+ -font "$var(graph,title,family) $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)"
- $var(graph) xaxis configure \
- -tickfont "$var(axis,font,family) $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
- -titlefont "$var(axis,title,family) $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
+ $var(graph$ii) xaxis configure \
+ -tickfont "$var(axis,font,family) $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
+ -titlefont "$var(axis,title,family) $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
- $var(graph) yaxis configure \
- -tickfont "$var(axis,font,family) $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
- -titlefont "$var(axis,title,family) $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
+ $var(graph$ii) yaxis configure \
+ -tickfont "$var(axis,font,family) $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
+ -titlefont "$var(axis,title,family) $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
- $var(graph) legend configure \
- -font "$var(legend,font,family) $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \
- -titlefont "$var(legend,title,family) $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)"
+ $var(graph$ii) legend configure \
+ -font "$var(legend,font,family) $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \
+ -titlefont "$var(legend,title,family) $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)"
- set options "-decorations false"
+ set options "-decorations false"
- # Color
- switch -- $ps(color) {
- rgb -
- cmyk {append options " -greyscale no"}
- gray {append options " -greyscale yes"}
- }
+ # Color
+ switch -- $ps(color) {
+ rgb -
+ cmyk {append options " -greyscale no"}
+ gray {append options " -greyscale yes"}
+ }
- # can't trust 'tk scaling'
- switch $ds9(wm) {
- x11 -
- win32 {
- set scaling [tk scaling]
- if {$scaling == Inf} {
- set scaling 1.334
+ # can't trust 'tk scaling'
+ switch $ds9(wm) {
+ x11 -
+ win32 {
+ set scaling [tk scaling]
+ if {$scaling == Inf} {
+ set scaling 1.334
+ }
}
+ aqua {set scaling 1.4}
}
- aqua {set scaling 1.4}
- }
- # Size
- set ww [expr [winfo width $var(top)]*$ps(scale)/100./$scaling]
- set hh [expr [winfo height $var(top)]*$ps(scale)/100./$scaling]
- append options " -width $ww -height $hh"
-
- # Page size
- switch -- $ps(size) {
- letter {append options " -paperwidth 8.5i -paperheight 11.i"}
- legal {append options " -paperwidth 8.5i -paperheight 14.i"}
- tabloid {append options " -paperwidth 11i -paperheight 17.i"}
- poster {append options " -paperwidth 36.i -paperheight 48.i"}
- a4 {append options " -paperwidth 195m -paperheight 282m"}
- other {
- if {$ps(width) != {} && $ps(height) != {}} {
- set pgww "[append ps(width) i]"
- set pghh "[append ps(height) i]"
- append options " -paperwidth $pgww -paperheight pghh"
- }
- }
- othermm {
- if {$ps(width) != {} && $ps(height) != {}} {
- set pgww "[append ps(width) m]"
- set pghh "[append ps(height) m]"
- append options " -paperwidth $pgww -paperheight pghh"
- }
- }
- }
+ # Size
+ set ww [expr [winfo width $var(top)]*$ps(scale)/100./$scaling]
+ set hh [expr [winfo height $var(top)]*$ps(scale)/100./$scaling]
+ append options " -width $ww -height $hh"
+
+ # Page size
+ switch -- $ps(size) {
+ letter {append options " -paperwidth 8.5i -paperheight 11.i"}
+ legal {append options " -paperwidth 8.5i -paperheight 14.i"}
+ tabloid {append options " -paperwidth 11i -paperheight 17.i"}
+ poster {append options " -paperwidth 36.i -paperheight 48.i"}
+ a4 {append options " -paperwidth 195m -paperheight 282m"}
+ other {
+ if {$ps(width) != {} && $ps(height) != {}} {
+ set pgww "[append ps(width) i]"
+ set pghh "[append ps(height) i]"
+ append options " -paperwidth $pgww -paperheight pghh"
+ }
+ }
+ othermm {
+ if {$ps(width) != {} && $ps(height) != {}} {
+ set pgww "[append ps(width) m]"
+ set pghh "[append ps(height) m]"
+ append options " -paperwidth $pgww -paperheight pghh"
+ }
+ }
+ }
- # Orientation
- switch -- $ps(orient) {
- portrait {append options " -landscape false"}
- landscape {append options " -landscape true"}
- }
+ # Orientation
+ switch -- $ps(orient) {
+ portrait {append options " -landscape false"}
+ landscape {append options " -landscape true"}
+ }
- if {$ps(dest) == "file" && $ps(filename) != {}} {
- eval $var(graph) postscript output $ps(filename) $options
- } else {
- set ch [open "| $ps(cmd)" w]
- puts $ch [eval $var(graph) postscript output $options]
- close $ch
- }
+ if {$ps(dest) == "file" && $ps(filename) != {}} {
+ eval $var(graph$ii) postscript output $ps(filename) $options
+ } else {
+ set ch [open "| $ps(cmd)" w]
+ puts $ch [eval $var(graph$ii) postscript output $options]
+ close $ch
+ }
- # reset fonts
- $var(graph) configure \
- -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)"
+ # reset fonts
+ $var(graph$ii) configure \
+ -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)"
- $var(graph) xaxis configure \
- -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
- -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
+ $var(graph$ii) xaxis configure \
+ -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
+ -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
- $var(graph) yaxis configure \
- -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
- -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
+ $var(graph$ii) yaxis configure \
+ -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \
+ -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)"
- $var(graph) legend configure \
- -font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \
- -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)"
+ $var(graph$ii) legend configure \
+ -font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \
+ -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)"
+ }
}
diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl
index a1490a2..738d083 100644
--- a/ds9/library/plotprocess.tcl
+++ b/ds9/library/plotprocess.tcl
@@ -54,7 +54,7 @@ proc PrefsDialogPlot {} {
grid $f.tnumlab $f.numlab -padx 2 -pady 2 -sticky w
# Data
- set f [ttk::labelframe $w.plot.data -text [msgcat::mc {Data Set}]]
+ set f [ttk::labelframe $w.plot.data -text [msgcat::mc {Dataset}]]
# Show
ttk::checkbutton $f.show -text [msgcat::mc {Show}] -variable pap(show)
@@ -316,6 +316,18 @@ proc PlotCmdExport {format fn} {
PlotExport $cvarname $fn $format
}
+proc PlotCmdSelectData {which} {
+ global cvarname
+ upvar #0 $cvarname cvar
+
+ set tt $cvar(graph,total)
+ set cc $cvar(graph,current)
+
+ set cvar(graph$cc,data,current) $which
+
+ PlotCurrentData $cvarname
+}
+
proc ProcessSendPlotCmd {proc id param {sock {}} {fn {}}} {
global iap
global parse
diff --git a/ds9/library/plotscatter.tcl b/ds9/library/plotscatter.tcl
index 0d6fe11..08308cc 100644
--- a/ds9/library/plotscatter.tcl
+++ b/ds9/library/plotscatter.tcl
@@ -156,7 +156,7 @@ proc PlotScatterUpdateElement {varname} {
set cc $var(graph,current)
# warning: uses current vars
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
@@ -185,7 +185,7 @@ proc PlotScatterUpdateElement {varname} {
set cap 0
}
- $var(graph) element configure "d-${nn}" \
+ $var(graph$cc) element configure "d-${nn}" \
-label $var(name) -hide [expr !$var(show)] \
-symbol $var(shape,symbol) -fill $clr -scalesymbols no \
-outline $var(shape,color) \
@@ -193,7 +193,7 @@ proc PlotScatterUpdateElement {varname} {
-showerrorbars $show -errorbarcolor $var(error,color) \
-errorbarwidth $var(error,width) -errorbarcap $cap
- $var(graph) pen configure active -color blue \
+ $var(graph$cc) pen configure active -color blue \
-symbol $var(shape,symbol) \
-linewidth 0 -pixels 5 \
-showerrorbars $show -errorbarcolor $var(error,color) \
@@ -207,7 +207,7 @@ proc PlotScatterButton {varname x y} {
set tt $var(graph,total)
set cc $var(graph,current)
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
@@ -215,18 +215,18 @@ proc PlotScatterButton {varname x y} {
return
}
- set rr [$var(graph) element closest $x $y]
+ set rr [$var(graph$cc) element closest $x $y]
set elem [lindex $rr 1]
set row [lindex $rr 3]
if {$elem != {}} {
if {$row != {}} {
- $var(graph) element deactivate $elem
- $var(graph) element activate $elem $row
+ $var(graph$cc) element deactivate $elem
+ $var(graph$cc) element activate $elem $row
# rows start at 1
eval "$var(callback) [expr $row+1]"
} else {
- $var(graph) element deactivate $elem
+ $var(graph$cc) element deactivate $elem
eval "$var(callback) {}"
}
}
@@ -239,15 +239,15 @@ proc PlotScatterHighliteElement {varname rowlist} {
set tt $var(graph,total)
set cc $var(graph,current)
- if {$tt == 0} {
+ if {$var(graph$cc,data,total) == 0} {
return
}
if {$var(show)} {
- $var(graph) element deactivate d-1
+ $var(graph$cc) element deactivate d-1
if {$rowlist != {}} {
# can have multiple rows
- eval "$var(graph) element activate d-1 $rowlist"
+ eval "$var(graph$cc) element activate d-1 $rowlist"
}
}
}