summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-07-19 20:55:29 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-07-19 20:55:29 (GMT)
commita1bd2ebf24593fca48a94a212e61bce0f19ebf63 (patch)
tree7f54443db2acb4233453cf102c4be077eca41247
parent689509c0a5eae9c5b2ea4f62fe0dd9d0e969d167 (diff)
downloadblt-a1bd2ebf24593fca48a94a212e61bce0f19ebf63.zip
blt-a1bd2ebf24593fca48a94a212e61bce0f19ebf63.tar.gz
blt-a1bd2ebf24593fca48a94a212e61bce0f19ebf63.tar.bz2
support multiple graphs per plot
-rw-r--r--ds9/library/markeranalysishist.tcl16
-rw-r--r--ds9/library/markeranalysisplot2d.tcl59
-rw-r--r--ds9/library/markeranalysisradial.tcl30
3 files changed, 50 insertions, 55 deletions
diff --git a/ds9/library/markeranalysishist.tcl b/ds9/library/markeranalysishist.tcl
index eaf9a80..e3feefb 100644
--- a/ds9/library/markeranalysishist.tcl
+++ b/ds9/library/markeranalysishist.tcl
@@ -70,25 +70,21 @@ proc MarkerAnalysisHistogramCB {frame id} {
set ydata ${vvarname}yy
global $xdata $ydata
- set ping [PlotPing $vvarname]
+ if {[info command $xdata] == {}} {
+ blt::vector create $xdata $ydata
+ }
+ $frame get marker $id analysis histogram $xdata $ydata $vvar(nbins)
- if {!$ping} {
- set tt [string totitle [$frame get marker $id type]]
+ if {![PlotPing $vvarname]} {
set bunit [string trim [$frame get fits header keyword BUNIT]]
if {$bunit=={}} {
set bunit {Values}
}
- PlotLineDialog $vvarname $tt
+ PlotLineDialog $vvarname [string totitle [$frame get marker $id type]]
PlotTitle $vvarname Histogram $bunit Counts
set vvar(graph,ds,xdata) $xdata
set vvar(graph,ds,ydata) $ydata
- blt::vector create $xdata $ydata
- }
-
- $frame get marker $id analysis histogram $xdata $ydata $vvar(nbins)
-
- if {!$ping} {
set vvar(graph,ds,smooth) step
set vvar(graph,ds,fill) 1
PlotExternal $vvarname xy
diff --git a/ds9/library/markeranalysisplot2d.tcl b/ds9/library/markeranalysisplot2d.tcl
index 1dc7d09..85f2e17 100644
--- a/ds9/library/markeranalysisplot2d.tcl
+++ b/ds9/library/markeranalysisplot2d.tcl
@@ -149,17 +149,24 @@ proc MarkerAnalysisPlot2dCB {frame id} {
set xcdata ${vvarname}xc
set ycdata ${vvarname}yc
global $xdata $ydata $xcdata $ycdata
-
- set ping [PlotPing $vvarname]
-
- if {!$ping} {
- set tt [string totitle [$frame get marker $id type]]
+ if {[info command $xdata] == {}} {
+ blt::vector create $xdata $ydata
+ }
+ # vectors may still be present due to previous graph deletion
+ if {[info command $xcdata] == {}} {
+ blt::vector create $xcdata $ycdata
+ }
+ $frame get marker $id analysis plot2d $xdata $ydata $xcdata $ycdata \
+ $vvar(system) $vvar(sky) $vvar(method)
+
+ if {![PlotPing $vvarname]} {
set vvar(bunit) [string trim [$frame get fits header keyword BUNIT]]
if {$vvar(bunit)=={}} {
set vvar(bunit) {Counts}
}
- PlotLineDialog $vvarname $tt
+ PlotLineDialog $vvarname [string totitle [$frame get marker $id type]]
PlotTitle $vvarname {} $vvar(system) $vvar(bunit)
+
MarkerAnalysisPlot2dXAxisTitle $vvarname
MarkerAnalysisPlot2dYAxisTitle $vvarname
@@ -173,13 +180,6 @@ proc MarkerAnalysisPlot2dCB {frame id} {
set vvar(graph,ds,xdata) $xdata
set vvar(graph,ds,ydata) $ydata
- blt::vector create $xdata $ydata $xcdata $ycdata
- }
-
- $frame get marker $id analysis plot2d $xdata $ydata $xcdata $ycdata \
- $vvar(system) $vvar(sky) $vvar(method)
-
- if {!$ping} {
PlotExternal $vvarname xy
}
@@ -198,18 +198,17 @@ proc MarkerAnalysisPlot2dDeleteCB {frame id} {
upvar #0 $vvarname vvar
global $vvarname
- set xcdata ${vvarname}xc
- set ycdata ${vvarname}yc
-
- # clear extra vectors
- global $xcdata $ycdata
- catch {blt::vector destroy $xcdata $ycdata}
-
# clear any errors
global errorInfo
set errorInfo {}
PlotDestroy $vvarname
+
+ # clear extra vectors
+ set xcdata ${vvarname}xc
+ set ycdata ${vvarname}yc
+ global $xcdata $ycdata
+ blt::vector destroy $xcdata $ycdata
}
proc MarkerAnalysisPlot2dXAxisTitle {vvarname} {
@@ -230,22 +229,24 @@ proc MarkerAnalysisPlot2dXAxisTitle {vvarname} {
}
}
- # set for plot code
- set vvar(graph,axis,x,title) $xtitle
-
- # update now (may not make it into plot code)
- $vvar(graph) xaxis configure -title $xtitle
+ set cc 1
+ if {[info exists vvar($cc,graph)]} {
+ set vvar($cc,axis,x,title) $xtitle
+ $vvar($cc,graph) xaxis configure -title $xtitle
+ }
}
proc MarkerAnalysisPlot2dYAxisTitle {vvarname} {
upvar #0 $vvarname vvar
global $vvarname
- # set for plot code
- set vvar(graph,axis,y,title) "$vvar(bunit) [string totitle $vvar(method)]"
+ set ytitle "$vvar(bunit) [string totitle $vvar(method)]"
- # update now (may not make it into plot code)
- $vvar(graph) yaxis configure -title $vvar(graph,axis,y,title)
+ set cc 1
+ if {[info exists vvar($cc,graph)]} {
+ set vvar($cc,axis,y,title) $ytitle
+ $vvar($cc,graph) yaxis configure -title $ytitle
+ }
}
proc MarkerAnalysisPlot2dXAxis {vvarname w xx} {
diff --git a/ds9/library/markeranalysisradial.tcl b/ds9/library/markeranalysisradial.tcl
index c5bd7ac..664250d 100644
--- a/ds9/library/markeranalysisradial.tcl
+++ b/ds9/library/markeranalysisradial.tcl
@@ -100,24 +100,21 @@ proc MarkerAnalysisRadialCB {frame id} {
set yedata ${vvarname}ye
global $xdata $ydata $yedata
- set ping [PlotPing $vvarname]
-
- if {!$ping} {
+ if {[info command $xdata] == {}} {
+ blt::vector create $xdata $ydata $yedata
+ }
+ $frame get marker $id analysis radial $xdata $ydata $yedata $sys
+
+ if {![PlotPing $vvarname]} {
PlotLineDialog $vvarname [string totitle [$frame get marker $id type]]
PlotTitle $vvarname "Radial Profile" $sys {}
+
MarkerAnalysisRadialAxisTitle $vvarname
set vvar(graph,ds,xdata) $xdata
set vvar(graph,ds,ydata) $ydata
set vvar(graph,ds,yedata) $yedata
- blt::vector create $xdata $ydata $yedata
- }
-
- $frame get marker $id analysis radial $xdata $ydata $yedata $sys
-
- if {!$ping} {
PlotExternal $vvarname xyey
- $vvar(proc,updateelement) $vvarname
}
PlotStats $vvarname
@@ -164,11 +161,12 @@ proc MarkerAnalysisRadialAxisTitle {vvarname} {
}
}
- # set for plot code
- set vvar(graph,axis,x,title) $xtitle
- set vvar(graph,axis,y,title) $ytitle
+ set cc 1
+ if {[info exists vvar($cc,graph)]} {
+ set vvar($cc,axis,x,title) $xtitle
+ set vvar($cc,axis,y,title) $ytitle
- # update now (may not make it into plot code)
- $vvar(graph) xaxis configure -title $xtitle
- $vvar(graph) yaxis configure -title $ytitle
+ $vvar($cc,graph) xaxis configure -title $xtitle
+ $vvar($cc,graph) yaxis configure -title $ytitle
+ }
}