summaryrefslogtreecommitdiffstats
path: root/ds9/library
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-07-26 20:41:49 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-07-26 20:41:49 (GMT)
commit4520b599669659243e1e1a5538ad4eaea863b9ad (patch)
treee9be0d74d726b81175845d142716e8db347b68de /ds9/library
parent4478809cbc9e86756b98dfd0ceefd9bf64c3a085 (diff)
downloadblt-4520b599669659243e1e1a5538ad4eaea863b9ad.zip
blt-4520b599669659243e1e1a5538ad4eaea863b9ad.tar.gz
blt-4520b599669659243e1e1a5538ad4eaea863b9ad.tar.bz2
support multiple graphs per plot
Diffstat (limited to 'ds9/library')
-rw-r--r--ds9/library/plot.tcl85
-rw-r--r--ds9/library/plotdialog.tcl6
-rw-r--r--ds9/library/plotstate.tcl2
3 files changed, 58 insertions, 35 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 1f5c4fe..134a52d 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -617,25 +617,39 @@ proc PlotUpdateCanvas {varname} {
if {$var(layout,lock)} {
set legendpos plotarea
- if {[info exists ${varname}($first,1,xdata)]} {
- set xmin [blt::vector expr min($var($first,1,xdata))]
- set xmax [blt::vector expr max($var($first,1,xdata))]
+ if {$var($first,axis,x,auto)} {
+ if {[info exists ${varname}($first,1,xdata)]} {
+ set xmin [blt::vector expr min($var($first,1,xdata))]
+ set xmax [blt::vector expr max($var($first,1,xdata))]
+ } else {
+ set xmin 0
+ set xmax 1
+ }
} else {
- set xmin 0
- set xmax 1
+ set xmin $var($first,axis,x,min)
+ set xmax $var($first,axis,x,max)
}
- if {[info exists ${varname}($first,1,ydata)]} {
- set ymin [blt::vector expr min($var($first,1,ydata))]
- set ymax [blt::vector expr max($var($first,1,ydata))]
+
+ if {$var($first,axis,y,auto)} {
+ if {[info exists ${varname}($first,1,ydata)]} {
+ set ymin [blt::vector expr min($var($first,1,ydata))]
+ set ymax [blt::vector expr max($var($first,1,ydata))]
+ } else {
+ set ymin 0
+ set ymax 1
+ }
} else {
- set ymin 0
- set ymax 1
+ set ymin $var($first,axis,y,min)
+ set ymax $var($first,axis,y,max)
}
+ set var(layout,axis,x,grid) $var($first,axis,x,grid)
set var(layout,axis,x,log) $var($first,axis,x,log)
set var(layout,axis,x,flip) $var($first,axis,x,flip)
set var(layout,axis,x,min) $xmin
set var(layout,axis,x,max) $xmax
+
+ set var(layout,axis,y,grid) $var($first,axis,y,grid)
set var(layout,axis,y,log) $var($first,axis,y,log)
set var(layout,axis,y,flip) $var($first,axis,y,flip)
set var(layout,axis,y,min) $ymin
@@ -643,10 +657,15 @@ proc PlotUpdateCanvas {varname} {
} else {
set legendpos $var(legend,position)
+ set var(layout,axis,x,grid) 1
set var(layout,axis,x,log) 0
set var(layout,axis,x,flip) 0
set var(layout,axis,x,min) 0
set var(layout,axis,x,max) 1
+
+ set var(layout,axis,y,grid) 1
+ set var(layout,axis,y,log) 0
+ set var(layout,axis,y,flip) 0
set var(layout,axis,y,min) 0
set var(layout,axis,y,max) 1
}
@@ -699,13 +718,9 @@ proc PlotUpdateCanvas {varname} {
$var($cc,graph) xaxis configure -exterior 0
$var($cc,graph) yaxis configure -exterior 0
- $var($cc,graph) x2axis configure -hide no \
- -grid no \
- -exterior 0 \
+ $var($cc,graph) x2axis configure -hide no -grid no -exterior 0 \
-bg $var(background)
- $var($cc,graph) y2axis configure -hide no \
- -grid no \
- -exterior 0 \
+ $var($cc,graph) y2axis configure -hide no -grid no -exterior 0 \
-bg $var(background)
switch $var(layout) {
@@ -759,10 +774,8 @@ proc PlotUpdateCanvas {varname} {
$var($cc,graph) configure -plotpadx 0 -plotpady 0 \
-topmargin 0 -bottommargin 0 -leftmargin 0 -rightmargin 0
- $var($cc,graph) xaxis configure -exterior 1 \
- -showticks 1
- $var($cc,graph) yaxis configure -exterior 1 \
- -showticks 1
+ $var($cc,graph) xaxis configure -exterior 1 -showticks 1
+ $var($cc,graph) yaxis configure -exterior 1 -showticks 1
$var($cc,graph) x2axis configure -hide yes
$var($cc,graph) y2axis configure -hide yes
@@ -777,8 +790,6 @@ proc PlotUpdateGraph {varname} {
PlotSaveState $varname
if {$var(graph,axis,x,manage)} {
- set xlog $var(graph,axis,x,log)
- set xflip $var(graph,axis,x,flip)
if {$var(graph,axis,x,auto)} {
set xmin {}
set xmax {}
@@ -787,15 +798,11 @@ proc PlotUpdateGraph {varname} {
set xmax $var(graph,axis,x,max)
}
} else {
- set xlog $var(layout,axis,x,log)
- set xflip $var(layout,axis,x,flip)
set xmin $var(layout,axis,x,min)
set xmax $var(layout,axis,x,max)
}
if {$var(graph,axis,y,manage)} {
- set ylog $var(graph,axis,y,log)
- set yflip $var(graph,axis,y,flip)
if {$var(graph,axis,y,auto)} {
set ymin {}
set ymax {}
@@ -804,12 +811,28 @@ proc PlotUpdateGraph {varname} {
set ymax $var(graph,axis,y,max)
}
} else {
- set ylog $var(layout,axis,y,log)
- set yflip $var(layout,axis,y,flip)
set ymin $var(layout,axis,y,min)
set ymax $var(layout,axis,y,max)
}
+ if {$var(graph,axis,x,manage) && $var(graph,axis,y,manage)} {
+ set xgrid $var(graph,axis,x,grid)
+ set xlog $var(graph,axis,x,log)
+ set xflip $var(graph,axis,x,flip)
+
+ set ygrid $var(graph,axis,y,grid)
+ set ylog $var(graph,axis,y,log)
+ set yflip $var(graph,axis,y,flip)
+ } else {
+ set xgrid $var(layout,axis,x,grid)
+ set xlog $var(layout,axis,x,log)
+ set xflip $var(layout,axis,x,flip)
+
+ set ygrid $var(layout,axis,y,grid)
+ set ylog $var(layout,axis,y,log)
+ set yflip $var(layout,axis,y,flip)
+ }
+
if {$var(graph,format)} {
if {$var(graph,axis,x,format) != {}} {
$var(graph) xaxis configure \
@@ -827,12 +850,10 @@ proc PlotUpdateGraph {varname} {
# Graph
$var(graph) xaxis configure \
- -min $xmin -max $xmax -descending $xflip \
- -grid $var(graph,axis,x,grid) -logscale $xlog
+ -min $xmin -max $xmax -descending $xflip -grid $xgrid -logscale $xlog
$var(graph) yaxis configure \
- -min $ymin -max $ymax -descending $yflip \
- -grid $var(graph,axis,y,grid) -logscale $ylog
+ -min $ymin -max $ymax -descending $yflip -grid $ygrid -logscale $ylog
if {$var(graph,axis,x,manage)} {
$var(graph) configure -plotpadx 0 -plotpady 0 -title $var(graph,title)
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index a87b72b..f4151d5 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -148,7 +148,7 @@ proc PlotDialog {varname wtt} {
-variable ${varname}(layout) -value row \
-command [list PlotChangeLayout $varname]
$var(mb).canvas.layout add separator
- $var(mb).canvas.layout add checkbutton -label [msgcat::mc {Lock Axis}] \
+ $var(mb).canvas.layout add checkbutton -label [msgcat::mc {Lock}] \
-variable ${varname}(layout,lock) \
-command [list PlotChangeLayout $varname]
@@ -634,12 +634,12 @@ proc PlotUpdateMenus {varname} {
# Canvas
switch $var(layout) {
grid {
- $var(mb).canvas.layout entryconfig [msgcat::mc {Lock Axis}] \
+ $var(mb).canvas.layout entryconfig [msgcat::mc {Lock}] \
-state disabled
}
row -
column {
- $var(mb).canvas.layout entryconfig [msgcat::mc {Lock Axis}] \
+ $var(mb).canvas.layout entryconfig [msgcat::mc {Lock}] \
-state normal
}
}
diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl
index 1c02617..07ee921 100644
--- a/ds9/library/plotstate.tcl
+++ b/ds9/library/plotstate.tcl
@@ -11,10 +11,12 @@ proc PlotDefState {} {
# per Canvas
set pap(layout) grid
set pap(layout,lock) 0
+ set pap(layout,axis,x,grid) 0
set pap(layout,axis,x,log) 0
set pap(layout,axis,x,flip) 0
set pap(layout,axis,x,min) 0
set pap(layout,axis,x,max) 0
+ set pap(layout,axis,y,grid) 0
set pap(layout,axis,y,log) 0
set pap(layout,axis,y,flip) 0
set pap(layout,axis,y,min) 0