From 99a1bed89f3c48f6ad1bd7b3a89d82a7bf530bf6 Mon Sep 17 00:00:00 2001 From: William Joye Date: Wed, 22 May 2019 16:20:12 -0400 Subject: add strip plot support --- ds9/library/plot.tcl | 42 +++++++++++++++++++++--------------------- ds9/library/plotbar.tcl | 18 +++++++++--------- ds9/library/plotdialog.tcl | 2 +- ds9/library/plotline.tcl | 12 ++++++------ ds9/library/plotprint.tcl | 20 ++++++++++---------- ds9/library/plotscatter.tcl | 26 +++++++++++++------------- 6 files changed, 60 insertions(+), 60 deletions(-) diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index fef5400..0cc8194 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -105,12 +105,12 @@ proc PlotChangeMode {varname} { switch $var(mode) { pointer { - blt::RemoveBindTag $var(graph) zoom-$var(graph) - bind $var(graph) <1> [list PlotButton $varname %x %y] + blt::RemoveBindTag $var(plot) zoom-$var(plot) + bind $var(plot) <1> [list PlotButton $varname %x %y] } zoom { - bind $var(graph) <1> {} - blt::AddBindTag $var(graph) zoom-$var(graph) + bind $var(plot) <1> {} + blt::AddBindTag $var(plot) zoom-$var(plot) } } } @@ -131,10 +131,10 @@ proc PlotClearData {varname} { for {set nn 1} {$nn<=$var(data,total)} {incr nn} { if {$var($nn,manage)} { # delete elements - foreach el [$var(graph) element names] { + foreach el [$var(plot) element names] { set f [split $el -] if {[lindex $f 1] == $nn} { - $var(graph) element delete $el + $var(plot) element delete $el } } @@ -1089,23 +1089,23 @@ proc PlotUpdateGraph {varname} { set ymax $var(axis,y,max) } - $var(graph) xaxis configure -min $xmin -max $xmax \ + $var(plot) xaxis configure -min $xmin -max $xmax \ -descending $var(axis,x,flip) - $var(graph) yaxis configure -min $ymin -max $ymax \ + $var(plot) 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(plot) xaxis configure \ -command [list PlotAxisFormat $varname x] } else { - $var(graph) xaxis configure -command {} + $var(plot) xaxis configure -command {} } if {$var(axis,y,format) != {}} { - $var(graph) yaxis configure \ + $var(plot) yaxis configure \ -command [list PlotAxisFormat $varname y] } else { - $var(graph) yaxis configure -command {} + $var(plot) yaxis configure -command {} } } @@ -1132,26 +1132,26 @@ proc PlotUpdateGraph {varname} { } # Graph - $var(graph) configure -plotpadx 0 -plotpady 0 \ + $var(plot) 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(plot) 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(plot) 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(plot) 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)" \ @@ -1169,23 +1169,23 @@ proc PlotCreateElement {varname} { # delete current elements set nn $var(data,current) - foreach el [$var(graph) element names] { + foreach el [$var(plot) element names] { set f [split $el -] if {[lindex $f 1] == $nn} { - $var(graph) element delete $el + $var(plot) element delete $el } } global $var(xdata) $var(ydata) - $var(graph) element create "d-${nn}" -xdata $var(xdata) -ydata $var(ydata) + $var(plot) 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(plot) 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(plot) element configure "d-${nn}" -yerror $var(yedata) } } } diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl index d64aba6..d71c62d 100644 --- a/ds9/library/plotbar.tcl +++ b/ds9/library/plotbar.tcl @@ -141,24 +141,24 @@ proc PlotDialogBar {varname} { # graph set var(type) bar - set var(frame) [ttk::frame $var(top).fr] - set var(graph) [blt::barchart $var(frame).bar \ + set var(graph) [ttk::frame $var(top).fr] + set var(plot) [blt::barchart $var(graph).bar \ -width 600 \ -height 500 \ -highlightthickness 0 \ ] - $var(graph) xaxis configure -grid no -stepsize 0 - $var(graph) yaxis configure -grid yes + $var(plot) xaxis configure -grid no -stepsize 0 + $var(plot) yaxis configure -grid yes + pack $var(plot) -expand yes -fill both pack $var(graph) -expand yes -fill both - pack $var(frame) -expand yes -fill both # set up zoom stack, assuming mode is zoom 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(plot) -mode release} + aqua {Blt_ZoomStack $var(plot) -mode release -button "ButtonPress-2"} } } @@ -167,7 +167,7 @@ proc PlotBarUpdateGraph {varname} { global $varname PlotUpdateGraph $varname - $var(graph) configure -barmode $var(bar,mode) + $var(plot) configure -barmode $var(bar,mode) } proc PlotBarUpdateElement {varname} { @@ -189,7 +189,7 @@ proc PlotBarUpdateElement {varname} { set cap 0 } - $var(graph) element configure "d-${nn}" \ + $var(plot) 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 4a03f3a..65cad6b 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -614,7 +614,7 @@ proc PlotExport {varname fn format} { # besure we are on top raise $var(top) - set rr [catch {image create photo -format window -data $var(frame)} ph] + set rr [catch {image create photo -format window -data $var(graph)} ph] if {$rr} { Error $iap(error) return diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl index f459c02..f3763e8 100644 --- a/ds9/library/plotline.tcl +++ b/ds9/library/plotline.tcl @@ -221,21 +221,21 @@ proc PlotDialogLine {varname} { # graph set var(type) line - set var(frame) [ttk::frame $var(top).fr] - set var(graph) [blt::graph $var(frame).line \ + set var(graph) [ttk::frame $var(top).fr] + set var(plot) [blt::graph $var(graph).line \ -width 600 \ -height 500 \ -highlightthickness 0 \ ] + pack $var(plot) -expand yes -fill both pack $var(graph) -expand yes -fill both - pack $var(frame) -expand yes -fill both # set up zoom stack, assuming mode is zoom 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(plot) -mode release} + aqua {Blt_ZoomStack $var(plot) -mode release -button "ButtonPress-2"} } } @@ -281,7 +281,7 @@ proc PlotLineUpdateElement {varname} { set cap 0 } - $var(graph) element configure "d-${nn}" \ + $var(plot) 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..7ceeaef 100644 --- a/ds9/library/plotprint.tcl +++ b/ds9/library/plotprint.tcl @@ -23,18 +23,18 @@ proc PlotPostScript {varname} { global ds9 # set postscript fonts - $var(graph) configure \ + $var(plot) configure \ -font "$var(graph,title,family) $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" - $var(graph) xaxis configure \ + $var(plot) 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 \ + $var(plot) 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 \ + $var(plot) 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)" @@ -94,26 +94,26 @@ proc PlotPostScript {varname} { } if {$ps(dest) == "file" && $ps(filename) != {}} { - eval $var(graph) postscript output $ps(filename) $options + eval $var(plot) postscript output $ps(filename) $options } else { set ch [open "| $ps(cmd)" w] - puts $ch [eval $var(graph) postscript output $options] + puts $ch [eval $var(plot) postscript output $options] close $ch } # reset fonts - $var(graph) configure \ + $var(plot) configure \ -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" - $var(graph) xaxis configure \ + $var(plot) 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 \ + $var(plot) 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 \ + $var(plot) 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/plotscatter.tcl b/ds9/library/plotscatter.tcl index f5b7c0c..1c66bb5 100644 --- a/ds9/library/plotscatter.tcl +++ b/ds9/library/plotscatter.tcl @@ -148,21 +148,21 @@ proc PlotDialogScatter {varname} { # graph set var(type) scatter - set var(frame) [ttk::frame $var(top).fr] - set var(graph) [blt::graph $var(frame).scatter \ + set var(graph) [ttk::frame $var(top).fr] + set var(plot) [blt::graph $var(graph).scatter \ -width 600 \ -height 500 \ -highlightthickness 0 \ ] + pack $var(plot) -expand yes -fill both pack $var(graph) -expand yes -fill both - pack $var(frame) -expand yes -fill both # set up zoom stack, assuming mode is zoom 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(plot) -mode release} + aqua {Blt_ZoomStack $var(plot) -mode release -button "ButtonPress-2"} } } @@ -200,7 +200,7 @@ proc PlotScatterUpdateElement {varname} { set cap 0 } - $var(graph) element configure "d-${nn}" \ + $var(plot) element configure "d-${nn}" \ -label $var(name) -hide [expr !$var(show)] \ -symbol $var(shape,symbol) -fill $clr -scalesymbols no \ -outline $var(shape,color) \ @@ -208,7 +208,7 @@ proc PlotScatterUpdateElement {varname} { -showerrorbars $show -errorbarcolor $var(error,color) \ -errorbarwidth $var(error,width) -errorbarcap $cap - $var(graph) pen configure active -color blue \ + $var(plot) pen configure active -color blue \ -symbol $var(shape,symbol) \ -linewidth 0 -pixels 5 \ -showerrorbars $show -errorbarcolor $var(error,color) \ @@ -227,18 +227,18 @@ proc PlotScatterButton {varname x y} { return } - set rr [$var(graph) element closest $x $y] + set rr [$var(plot) 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(plot) element deactivate $elem + $var(plot) element activate $elem $row # rows start at 1 eval "$var(callback) [expr $row+1]" } else { - $var(graph) element deactivate $elem + $var(plot) element deactivate $elem eval "$var(callback) {}" } } @@ -253,10 +253,10 @@ proc PlotScatterHighliteElement {varname rowlist} { } if {$var(show)} { - $var(graph) element deactivate d-1 + $var(plot) element deactivate d-1 if {$rowlist != {}} { # can have multiple rows - eval "$var(graph) element activate d-1 $rowlist" + eval "$var(plot) element activate d-1 $rowlist" } } } -- cgit v0.12