summaryrefslogtreecommitdiffstats
path: root/ds9/library
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-05-22 20:15:43 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-05-22 20:15:43 (GMT)
commit705be862346cf1bcd276af49b260a5da3b98ff4b (patch)
tree241d16ffa2e3dd45cd4c66221da21290b6650548 /ds9/library
parent0187eb22078f1d8b1b3e07c041a4e6a2ed9ea713 (diff)
downloadblt-705be862346cf1bcd276af49b260a5da3b98ff4b.zip
blt-705be862346cf1bcd276af49b260a5da3b98ff4b.tar.gz
blt-705be862346cf1bcd276af49b260a5da3b98ff4b.tar.bz2
add strip plot
Diffstat (limited to 'ds9/library')
-rw-r--r--ds9/library/manalysis.tcl2
-rw-r--r--ds9/library/plot.tcl68
-rw-r--r--ds9/library/plotdialog.tcl153
3 files changed, 135 insertions, 88 deletions
diff --git a/ds9/library/manalysis.tcl b/ds9/library/manalysis.tcl
index ddb49b0..cc49586 100644
--- a/ds9/library/manalysis.tcl
+++ b/ds9/library/manalysis.tcl
@@ -57,8 +57,6 @@ proc AnalysisMainMenu {} {
-command PlotBarTool
$ds9(mb).analysis add command -label "[msgcat::mc {Scatter Plot Tool}]..." \
-command PlotScatterTool
- $ds9(mb).analysis add command -label "[msgcat::mc {Strip Plot Tool}]..." \
- -command PlotStripTool
$ds9(mb).analysis add separator
$ds9(mb).analysis add command \
-label "[msgcat::mc {Virtual Observatory}]..."\
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 7a8bd42..fef5400 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -53,15 +53,6 @@ proc PlotDef {} {
set pap(axis,y,max) {}
set pap(axis,y,format) {}
- set pap(axis,y,title,res) {}
- set pap(axis,y,grid,res) 1
- set pap(axis,y,log,res) 0
- set pap(axis,y,flip,res) 0
- set pap(axis,y,auto,res) 1
- set pap(axis,y,min,res) {}
- set pap(axis,y,max,res) {}
- set pap(axis,y,format,res) {}
-
set pap(axis,title,family) helvetica
set pap(axis,title,size) 9
set pap(axis,title,weight) normal
@@ -92,6 +83,13 @@ proc PlotDef {} {
set pap(bar,mode) normal
}
+proc PlotAddPlot {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ global ds9
+}
+
proc PlotAxisFormat {varname axis w nn} {
upvar #0 $varname var
global $varname
@@ -99,6 +97,24 @@ proc PlotAxisFormat {varname axis w nn} {
return [format $var(axis,$axis,format) $nn]
}
+proc PlotChangeMode {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ global ds9
+
+ 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)
+ }
+ }
+}
+
proc PlotClearData {varname} {
upvar #0 $varname var
global $varname
@@ -161,12 +177,7 @@ proc PlotClearData {varname} {
set var(axis,y,max) {}
set var(axis,y,format) {}
- set var(axis,y,auto,res) 1
- set var(axis,y,min,res) {}
- set var(axis,y,max,res) {}
- set var(axis,y,format,res) {}
-
- $var(mb).data.select delete $ds9(menu,start) end
+ $var(mb).plot.select delete $ds9(menu,start) end
$var(proc,updategraph) $varname
PlotStats $varname
@@ -175,7 +186,7 @@ proc PlotClearData {varname} {
set var(data,total) 1
set var(data,current) 1
- $var(mb).data.select delete [expr $ds9(menu,start)+1] end
+ $var(mb).plot.select delete [expr $ds9(menu,start)+1] end
PlotCurrentData $varname
$var(proc,updategraph) $varname
}
@@ -427,7 +438,7 @@ proc PlotDataSetOne {varname dim data} {
PlotGetVar $varname $nn
# update data set menu
- $var(mb).data.select add radiobutton -label "$var(name)" \
+ $var(mb).plot.select add radiobutton -label "$var(name)" \
-variable ${varname}(data,current) -value $nn \
-command [list PlotCurrentData $varname]
@@ -435,6 +446,13 @@ proc PlotDataSetOne {varname dim data} {
$var(proc,updateelement) $varname
}
+proc PlotDeletePlot {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ global ds9
+}
+
proc PlotDupData {varname mm} {
upvar #0 $varname var
global $varname
@@ -490,7 +508,7 @@ proc PlotDupData {varname mm} {
set var($nn,bar,relief) $var($mm,bar,relief)
# update data set menu
- $var(mb).data.select add radiobutton -label "$var($nn,name)" \
+ $var(mb).plot.select add radiobutton -label "$var($nn,name)" \
-variable ${varname}(data,current) -value $nn \
-command [list PlotCurrentData $varname]
@@ -589,7 +607,7 @@ proc PlotExternal {varname} {
PlotGetVar $varname $nn
# update data set menu
- $var(mb).data.select add radiobutton \
+ $var(mb).plot.select add radiobutton \
-label "[msgcat::mc {Data Set}] $nn" \
-variable ${varname}(data,current) -value $nn \
-command "PlotCurrentData $varname"
@@ -895,15 +913,6 @@ proc PlotSaveConfigFile {varname filename} {
set analysisplot(axis,y,max) $var(axis,y,max)
set analysisplot(axis,y,format) $var(axis,y,format)
- set analysisplot(axis,y,title,res) $var(axis,y,title,res)
- set analysisplot(axis,y,grid,res) $var(axis,y,grid,res)
- set analysisplot(axis,y,log,res) $var(axis,y,log,res)
- set analysisplot(axis,y,flip,res) $var(axis,y,flip,res)
- set analysisplot(axis,y,auto,res) $var(axis,y,auto,res)
- set analysisplot(axis,y,min,res) $var(axis,y,min,res)
- set analysisplot(axis,y,max,res) $var(axis,y,max,res)
- set analysisplot(axis,y,format,res) $var(axis,y,format,res)
-
set analysisplot(axis,title,family) $var(axis,title,family)
set analysisplot(axis,title,size) $var(axis,title,size)
set analysisplot(axis,title,weight) $var(axis,title,weight)
@@ -1049,14 +1058,13 @@ proc PlotStatsDestroyCB {varname} {
set var(stats) 0
}
-proc PlotTitle {varname title xaxis yaxis {yaxis2 {}}} {
+proc PlotTitle {varname title xaxis yaxis} {
upvar #0 $varname var
global $varname
set var(graph,title) "$title"
set var(axis,x,title) "$xaxis"
set var(axis,y,title) "$yaxis"
- set var(axis,y,title,res) "$yaxis2"
}
proc PlotUpdateGraph {varname} {
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index 3d08f87..4a03f3a 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -41,7 +41,6 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
set var(graph,title) "$title"
set var(axis,x,title) "$xaxis"
set var(axis,y,title) "$yaxis"
- set var(axis,y,title,res) {}
# can be turned off for external line plots
set var(graph,format) 1
@@ -52,9 +51,10 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
$var(mb) add cascade -label [msgcat::mc {File}] -menu $var(mb).file
$var(mb) add cascade -label [msgcat::mc {Edit}] -menu $var(mb).edit
$var(mb) add cascade -label [msgcat::mc {Graph}] -menu $var(mb).graph
- $var(mb) add cascade -label [msgcat::mc {Axes}] -menu $var(mb).axes
+ $var(mb) add cascade -label [msgcat::mc {Plot}] -menu $var(mb).plot
$var(mb) add cascade -label [msgcat::mc {Data}] -menu $var(mb).data
+ # File
menu $var(mb).file
$var(mb).file add command -label "[msgcat::mc {Load Data}]..." \
-command [list PlotLoadData $varname]
@@ -100,7 +100,6 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
$var(mb).file add command -label [msgcat::mc {Close}] \
-command [list PlotDestroy $varname]
- # Export Menu
menu $var(mb).file.export
$var(mb).file.export add command -label {GIF...} \
-command [list PlotExportDialog $varname gif]
@@ -130,13 +129,24 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
# Graph
menu $var(mb).graph
+
+ $var(mb).graph add cascade -label [msgcat::mc {Select Plot}] \
+ -menu $var(mb).graph.select
+ $var(mb).graph add separator
+ $var(mb).graph add command -label [msgcat::mc {Add Plot}] \
+ -command [list PlotAddPlot $varname]
+ $var(mb).graph add command -label [msgcat::mc {Delete Plot}] \
+ -command [list PlotDeletePlot $varname]
+ $var(mb).graph add separator
+ menu $var(mb).graph.select
+
$var(mb).graph add cascade -label [msgcat::mc {Font}] \
-menu $var(mb).graph.font
$var(mb).graph add cascade -label [msgcat::mc {Background}] \
-menu $var(mb).graph.bg
$var(mb).graph add separator
$var(mb).graph add command -label "[msgcat::mc {Title}]..." \
- -command [list PlotTitleDialog $varname]
+ -command [list PlotGraphTitleDialog $varname]
menu $var(mb).graph.font
$var(mb).graph.font add cascade -label [msgcat::mc {Title}] \
@@ -158,78 +168,66 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
PlotColorMenu $var(mb).graph.bg $varname graph,bg [list $var(proc,updategraph) $varname]
- # Axes
- $var(mb).axes add cascade -label [msgcat::mc {Grid}] \
- -menu $var(mb).axes.grid
- $var(mb).graph add cascade -label [msgcat::mc {Legend}] \
- -menu $var(mb).axes.legend
+ # Plot
+ menu $var(mb).plot
+
+ $var(mb).plot add cascade -label [msgcat::mc {Select Data Set}] \
+ -menu $var(mb).plot.select
+ $var(mb).plot add separator
+ menu $var(mb).plot.select
- menu $var(mb).axes.grid
- $var(mb).axes.grid add checkbutton -label [msgcat::mc {X Grid}] \
+ $var(mb).plot add cascade -label [msgcat::mc {Axes}] \
+ -menu $var(mb).plot.axes
+ $var(mb).plot add cascade -label [msgcat::mc {Legend}] \
+ -menu $var(mb).plot.legend
+ $var(mb).plot add separator
+ $var(mb).plot add command -label "[msgcat::mc {Titles}]..." \
+ -command [list PlotPlotTitleDialog $varname]
+
+ menu $var(mb).plot.axes
+ $var(mb).plot.axes add checkbutton -label [msgcat::mc {X Grid}] \
-variable ${varname}(axis,x,grid) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.grid add checkbutton -label [msgcat::mc {Log}] \
+ $var(mb).plot.axes add checkbutton -label [msgcat::mc {Log}] \
-variable ${varname}(axis,x,log) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.grid add checkbutton -label [msgcat::mc {Flip}] \
+ $var(mb).plot.axes add checkbutton -label [msgcat::mc {Flip}] \
-variable ${varname}(axis,x,flip) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.grid add separator
- $var(mb).axes.grid add checkbutton -label [msgcat::mc {Y Grid}] \
+ $var(mb).plot.axes add separator
+ $var(mb).plot.axes add checkbutton -label [msgcat::mc {Y Grid}] \
-variable ${varname}(axis,y,grid) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.grid add checkbutton -label [msgcat::mc {Log}] \
+ $var(mb).plot.axes add checkbutton -label [msgcat::mc {Log}] \
-variable ${varname}(axis,y,log) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.grid add checkbutton -label [msgcat::mc {Flip}] \
+ $var(mb).plot.axes add checkbutton -label [msgcat::mc {Flip}] \
-variable ${varname}(axis,y,flip) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.grid add separator
- $var(mb).axes.grid add command -label "[msgcat::mc {Range}]..." \
+ $var(mb).plot.axes add separator
+ $var(mb).plot.axes add command -label "[msgcat::mc {Range}]..." \
-command [list PlotRangeDialog $varname]
- menu $var(mb).axes.legend
- $var(mb).axes.legend add checkbutton -label [msgcat::mc {Show}] \
+ menu $var(mb).plot.legend
+ $var(mb).plot.legend add checkbutton -label [msgcat::mc {Show}] \
-variable ${varname}(legend) \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.legend add separator
- $var(mb).axes.legend add radiobutton -label [msgcat::mc {Right}] \
+ $var(mb).plot.legend add separator
+ $var(mb).plot.legend add radiobutton -label [msgcat::mc {Right}] \
-variable ${varname}(legend,position) -value right \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.legend add radiobutton -label [msgcat::mc {Left}] \
+ $var(mb).plot.legend add radiobutton -label [msgcat::mc {Left}] \
-variable ${varname}(legend,position) -value left \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.legend add radiobutton -label [msgcat::mc {Top}] \
+ $var(mb).plot.legend add radiobutton -label [msgcat::mc {Top}] \
-variable ${varname}(legend,position) -value top \
-command [list $var(proc,updategraph) $varname]
- $var(mb).axes.legend add radiobutton -label [msgcat::mc {Bottom}] \
+ $var(mb).plot.legend add radiobutton -label [msgcat::mc {Bottom}] \
-variable ${varname}(legend,position) -value bottom \
-command [list $var(proc,updategraph) $varname]
# dataset
menu $var(mb).data
- $var(mb).data add cascade -label [msgcat::mc {Select}] \
- -menu $var(mb).data.select
- $var(mb).data add separator
- menu $var(mb).data.select
-}
-
-proc PlotChangeMode {varname} {
- upvar #0 $varname var
- global $varname
-
- global ds9
-
- 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)
- }
- }
}
proc PlotDataFormatDialog {xarname} {
@@ -369,15 +367,62 @@ proc PlotRangeDialog {varname} {
return $rr
}
-proc PlotTitleDialog {varname} {
+proc PlotGraphTitleDialog {varname} {
upvar #0 $varname var
global $varname
global ed
- set w {.aptitle}
+ set w {.apgraphtitle}
set ed(ok) 0
set ed(graph,title) $var(graph,title)
+
+ DialogCreate $w [msgcat::mc {Title}] ed(ok)
+
+ # Param
+ set f [ttk::frame $w.param]
+ ttk::label $f.label -text [msgcat::mc {Title}]
+ ttk::entry $f.title -textvariable ed(graph,title) -width 30
+
+ grid $f.label $f.title -padx 2 -pady 2 -sticky ew
+ grid columnconfigure $f 1 -weight 1
+
+ # Buttons
+ set f [ttk::frame $w.buttons]
+ ttk::button $f.ok -text [msgcat::mc {OK}] -command {set ed(ok) 1} \
+ -default active
+ ttk::button $f.cancel -text [msgcat::mc {Cancel}] -command {set ed(ok) 0}
+ pack $f.ok $f.cancel -side left -expand true -padx 2 -pady 4
+
+ bind $w <Return> {set ed(ok) 1}
+
+ # Fini
+ ttk::separator $w.sep -orient horizontal
+ pack $w.buttons $w.sep -side bottom -fill x
+ pack $w.param -side top -fill both -expand true
+
+ DialogCenter $w
+ DialogWait $w ed(ok) $w.param.title
+ DialogDismiss $w
+
+ if {$ed(ok)} {
+ set var(graph,title) $ed(graph,title)
+ $var(proc,updategraph) $varname
+ }
+
+ set rr $ed(ok)
+ unset ed
+ return $rr
+}
+
+proc PlotPlotTitleDialog {varname} {
+ upvar #0 $varname var
+ global $varname
+ global ed
+
+ set w {.applottitle}
+
+ set ed(ok) 0
set ed(axis,x,title) $var(axis,x,title)
set ed(axis,y,title) $var(axis,y,title)
set ed(legend,title) $var(legend,title)
@@ -386,8 +431,6 @@ proc PlotTitleDialog {varname} {
# Param
set f [ttk::frame $w.param]
- ttk::label $f.label -text [msgcat::mc {Plot Title}]
- ttk::entry $f.title -textvariable ed(graph,title) -width 30
ttk::label $f.xlabel -text [msgcat::mc {X Axis Title}]
ttk::entry $f.xtitle -textvariable ed(axis,x,title) -width 30
ttk::label $f.ylabel -text [msgcat::mc {Y Axis Title}]
@@ -395,7 +438,6 @@ proc PlotTitleDialog {varname} {
ttk::label $f.legendlabel -text [msgcat::mc {Legend Title}]
ttk::entry $f.legendtitle -textvariable ed(legend,title) -width 30
- grid $f.label $f.title -padx 2 -pady 2 -sticky ew
grid $f.xlabel $f.xtitle -padx 2 -pady 2 -sticky ew
grid $f.ylabel $f.ytitle -padx 2 -pady 2 -sticky ew
grid $f.legendlabel $f.legendtitle -padx 2 -pady 2 -sticky ew
@@ -416,11 +458,10 @@ proc PlotTitleDialog {varname} {
pack $w.param -side top -fill both -expand true
DialogCenter $w
- DialogWait $w ed(ok) $w.param.title
+ DialogWait $w ed(ok) $w.param.xtitle
DialogDismiss $w
if {$ed(ok)} {
- set var(graph,title) $ed(graph,title)
set var(axis,x,title) $ed(axis,x,title)
set var(axis,y,title) $ed(axis,y,title)
set var(legend,title) $ed(legend,title)
@@ -472,7 +513,7 @@ proc DatasetNameDialog {varname} {
DialogDismiss $w
if {$ed(ok)} {
- $var(mb).data.select entryconfig "$var(name)" -label "$ed(name)"
+ $var(mb).plot.select entryconfig "$var(name)" -label "$ed(name)"
set var(name) $ed(name)
$var(proc,updateelement) $varname
}