#!/usr/bin/wish ## ##+####################################################################### ## NOTE: ## If the 'wish' interpreter is in a different directory, such as ## /usr/local/bin, you can make a soft-link from 'wish' there to ## /usr/bin/wish, as root, with a command like ## ln -s /usr/bin/local/wish /usr/bin/wish ##+####################################################################### ## Tk SCRIPT NAME: tkGnuplotXY_logORloglog_file2or3cols.tk ## ## WHERE: in $FEDIR_TKGUIS/PLOTtools/tkGnuplotXY_logORloglog_file2or3cols/ ## ## where $FEDIR_TKGUIS = $FEDIR/tkGUIs and ## ## where $FEDIR is the installation ## directory of the FE subsystem that ## contains this script. ## ## Typically FEDIR is $HOME/apps/tkGooies_linux_yyyymmmdd ## after the 'tkGooies' self-extracting install script is run. ##+###################################################################### ## PURPOSE: A 'quick' xy-axis LOG (or LOG-LOG) file-plot utility using ## 'gnuplot' to read data from a file, selecting 2 or 3 columns ## of data to plot. ## ## Oriented toward plots of many (tens or hundreds of) data points ## -- via connecting lines rather than data point markers. ## ## (But data point markers can be an option --- instead of ## or in addition to the lines connecting data points.) ## _____________________________________________________________ ## ## This Tk script presents a GUI to prompt for a data-file name and ## to specify ## - which column of data to use for the x-axis, and ## - which column of data to use for y1 data --- and ## - with an option to specify a 3rd column for y2 data. ## ## The GUI also allows for specifying a title for the plot, ## x-axis and y-axis titles, x and y axis limits, [x and y axis ## tic-mark intervals,] plot lines/points/both, some colors, ## output type (PNG, GIF, JPG, PS, SVG) and image size in pixels. ## ##+######################### ## TYPICAL OPERATIONAL STEPS: ## ## After specifying/selecting the data file and changing the ## the colums of data to use (if needed), if the user takes the defaults ## for the other options on the GUI, the user can click on a 'Plot' ## button to cause the plot to be rendered and displayed. ## ## The user can click on the 'Help' button for a description ## of this utility (help which can be much more extensive than ## this description). ## ##+################# ## THE GUI WIDGETS: ## ## The options available to the user are indicated by ## the following 'sketch' of the GUI: ## ## FRAMEnames ## VVVVVVVVVV ## ------------------------------------------------------------------------------------------ ## Gnuplot LOG or LOG-LOG plot of 2 or 3 columns from a data file: ## [window title] ## ------------------------------------------------------------------------------------------ ## ## .fRbuttons {Exit} {Help} {Plot} {Color of {Color of {Color of X SameAxisUnits for Y1,Y2 ## Lines} axes} background} ## ## .fRfile Data Filename: _______________________________________________ {Browse...} ## ## .fRtitle Plot title: _________________Plot title goes here._____________________________________________________ ## ## .fRlogtype Log axes: O x O y O xy O neither ## ## .fRxaxis XColumn: 1__ XaxisMin ______ XaxisMax _______ XticLabelsCol#: __ _____X-axis label goes here____ ## ## .fRy1axis Y1Column: 2__ Y1axisMin ______ Y1axisMax _______ LineType(1-29): __ _____Y1-axis label goes here___ ## ## .fRy2axis Y2Column: ___ Y2axisMin ______ Y2axisMax _______ LineType(1-29): __ _____Y2-axis label goes here___ ## ## .fRplotopts PlotType: O Line O Point O Both LineWidth(1-6): 1 X Grid? X Border? ## ## .fRtics XticLabelsAngle: ___ YticLabelsAngle: ___ X Minor Tics? ## ## .fRoutopts Image file type: O GIF O PNG O JPG O PSc O PSbw O SVG O WXT {TestImg} Xpixels: 800__ Ypixels: 600__ ## ## .fRmsg [ .......... Messages go here ......................................................] ## ## ------------------------------------------------------------------- ## ## In the above sketch of the GUI: ## ## SQUARE BRACKETS indicate a comment (not to be placed on the GUI). ## BRACES indicate a Tk 'button' widget. ## UNDERSCORES indicate a Tk 'entry' widget. ## A COLON indicates that the text before the colon is on a 'label' widget. ## CAPITAL-O indicates a Tk 'radiobutton' widget. ## CAPITAL-X indicates a Tk 'checkbutton' widget (if any). ## ##+############## ## GUI components: ## ## From the GUI 'sketch' above, it is seen that the GUI consists of ## about ## ## - 7 button widgets ## - 13 label widgets ## - 15 entry widgets (3 more could be added to specify tic-mark interval) ## - 12 radiobutton widgets in 3 groups ## - 4 checkbutton widgets ## - 0 scale widgets ## - 0 listbox widgets ## ##+#################################################################### ## CALLED BY: This Tk script can be called by the command name ## ## $FEDIR/PlotTools/tkGnuplotXY_logORloglog_file2or3cols/ ## tkGnuplotXY_logORloglog_file2or3cols.tk ## ## where $FEDIR is the installation ## directory of the FE subsystem that ## contains this script. ## ## This script can be accessed via a drawer in a 'PLOTtools' ## toolchest (menu) in an FE 'tkGooies' toolchest. ## ##+#################################################################### ## ## INPUTS (via entry fields on the GUI): ## filename, column numbers, ## plot title, xy axis-labels, xy axis min-max, ## (xy tic-mark intervals, someday), ## image dimensions (in pixels). ## ## OUTPUT: An image file, displayed by an image-display program ## specified at the bottom of this Tk Script. ## ## The image file is put in a directory specified at the ## bottom of this Tk script. Example: /tmp ## ## An image capture of the Tk GUI and/or the output plot image ## with a screen capture tool. Example: 'gnome-screenshot'. ## ##+#################################################################### ## STRUCTURE OF THIS CODE: ## ## 0) Set general window parms (win-name, win-position, win-color-scheme, ## fonts-for-widgets, widget-geom-parms, text-array-for-labels-etc, ## win-size-control). ## ## 1a) Define ALL frames (and sub-frames, if any). ## 1b) Pack the frames. ## ## 2) Define & pack all widgets in the frames, frame by frame. ## After all the widgets for a frame are defined, pack them in the frame. ## ## 3) Define keyboard and/or mouse/touchpad/touch-sensitive-screen 'event' ## BINDINGS, if needed. ## 4) Define PROCS, if needed. ## 5) Additional GUI INITIALIZATION (typically with one or more of ## the procs), if needed. ## ## In more detail: ## ## 0a) Define ALL frames: ## 'fRbuttons', 'fRfile', 'fRtitle', 'fRlogtype', ## 'fRxaxis', 'fRy1axis', 'fRy2axis', ## 'fRplotopts', 'fRtics', 'fRoutopts', 'fRmsg' ## ## 0b) Pack frames with pack-parms to get proper behavior of widgets ## during window expansion. Example: Allow filename and axis-label ## input fields to x-expand. ## ## 1) Define & pack all widgets in the frames -- basically going through ## frames & their interiors in top-to-bottom, left-to-right order: ## - 'fRbuttons' contains several buttons -- 'Exit','Help','Plot',... ## - 'fRfile' contains 1 label & 1 entry & 1 button widget. ## - 'fRtitle' contains 1 label & 1 entry widget. ## - 'fRlogtype' contains 1 label & 4 radiobutton widgets. ## - 'fRxaxis' contains several label & entry widgets. ## - 'fRy1axis' contains several label & entry widgets. ## - 'fRy2axis' contains several label & entry widget. ## - 'fRplotopts' contains a label and several radiobutton widgets ## and a pair of label & entry widgets ## and 2 checkbuttons. ## - 'fRtics' contains 2 pairs of label & entry widgets, ## and a checkbutton. ## - 'fRoutopts' contains a label and several radiobutton widgets ## and 2 pairs of label & entry widgets. ## - 'fRmsg' contains a label (or message or text) widget. ## ## 2) Define bindings: (See BINDINGS code section.) ## ## 3) Define procs: (See PROCS code section.) ## - 'get_filename' - called by 'Browse4file' button ## - 'read_data' - called by '(Re)ReadFile' button ## - 'replot' - called by 'Plot' button; ## ## - 'edit_input' - called by the 'replot' proc ## - 'getset_color' - called by 'LineColor' 'AxisColor' 'BkgdColor' buttons ## - 'update_color_botton' - called by 'getset_color' proc and 3 times in the ## 'Additional GUI Initialization' section. ## ## 'popup_msgVarWithScroll' - called by 'Help' button to show HELPtext var. ## ## For other procs, see the PROCS section below. ## ## 4) Additional GUI initialization, if needed (with procs). ## (Can issue 'update_plot'.) ## ##+###################################################################### ## DEVELOPED/REVISED WITH: ## (Tcl 8.5)-(Tk 8.5) for fierst version in 2011, on Linux (Ubuntu 9.10). ## ## $ wish ## % puts "$tcl_version $tk_version" showed 8.5 8.5 on Ubuntu 9.10. ##+####################################################################### ## MAINTENANCE HISTORY: ## Started by: Blaise Montandon 2016jan19 Started this script based on ## some code from a similar frontend ## Tk script for 'gnuplot' named ## 'tkGnuplotXY_file2or3cols.tk'. ## Updated by: Blaise Montandon 2016 ##+####################################################################### ##+####################################################################### ## Set WINDOW TITLES and POSITION. ##+####################################################################### wm title . "Gnuplot LOG or LOG-LOG plot - of 2 or 3 columns from a data file" wm iconname . "GnuplotLOG" # wm geometry . +15+30 wm geometry . +15-30 ##+###################################################### ## Set the COLOR SCHEME for the window and its widgets --- ## such as entry field background color. ##+###################################################### ## Some initial colors for several color-choosing buttons ## on the GUI are set at the bottom of this script, ## in the 'Additional GUI Initialization' section. ##+###################################################### tk_setPalette "#e0e0e0" set entryBKGD "#f0f0f0" set radiobuttBKGD "#f0f0f0" set checkbuttBKGD "#f0f0f0" ##+######################################################## ## Set (temp) FONT NAMES. ## ## Use a VARIABLE-WIDTH font for text on label and ## button widgets. ## ## Use a FIXED-WIDTH font for text in the entry fields ## --- or in a listbox widget or in a text widget. ##+######################################################## font create fontTEMP_varwidth \ -family {comic sans ms} \ -size -14 \ -weight bold \ -slant roman font create fontTEMP_SMALL_varwidth \ -family {comic sans ms} \ -size -10 \ -weight bold \ -slant roman ## Some other possible (similar) variable width fonts: ## Arial ## Bitstream Vera Sans ## DejaVu Sans ## Droid Sans ## FreeSans ## Liberation Sans ## Nimbus Sans L ## Trebuchet MS ## Verdana font create fontTEMP_fixedwidth \ -family {liberation mono} \ -size -14 \ -weight bold \ -slant roman font create fontTEMP_SMALL_fixedwidth \ -family {liberation mono} \ -size -10 \ -weight bold \ -slant roman ## Some other possible fixed width fonts (esp. on Linux): ## Andale Mono ## Bitstream Vera Sans Mono ## Courier 10 Pitch ## DejaVu Sans Mono ## Droid Sans Mono ## FreeMono ## Nimbus Mono L ## TlwgMono ##+########################################################### ## SET GEOM VARS FOR THE VARIOUS WIDGET DEFINITIONS. ## (e.g. padding and borderwidth for Buttons) ##+########################################################### ## BUTTON widget geom settings: set PADXpx_button 0 set PADYpx_button 0 set BDwidthPx_button 2 ## LABEL widget geom settings: set PADXpx_label 0 set PADYpx_label 0 set BDwidthPx_label 2 set RELIEF_label_lo "flat" set RELIEF_label_hi "groove" ## relief must be: flat, groove, raised, ridge, solid, or sunken ## ENTRY widget geom settings: set BDwidthPx_entry 2 set initEntryWidthChars 50 ## RADIOBUTTON geom parameters: set PADXpx_radbutt 0 set PADYpx_radbutt 0 set BDwidthPx_radbutt 2 set RELIEF_radbutt_hi "ridge" set RELIEF_radbutt_lo "flat" ## CHECKBUTTON geom parameters: set PADXpx_chkbutt 0 set PADYpx_chkbutt 0 set BDwidthPx_chkbutt 2 set RELIEF_chkbutt_hi "groove" set RELIEF_chkbutt_lo "flat" ## LISTBOX geom settings: # set BDwidthPx_listbox 2 # set initListboxWidthChars 50 # set initListboxHeightChars 8 ## SCALE geom parameters: # set BDwidthPx_scale 2 # set initScaleLengthPx 300 # set scaleWidthPx 10 ##+###################################################### ## Set a MIN-SIZE of the window (roughly). ## ## Set approx MIN WIDTH according to widgets across the ## '.fRbuttons' frame. ## ## Set approx MIN HEIGHT according to the height of the ## vertical 'stack' of frames. ##+###################################################### set minWinWidthPx [font measure fontTEMP_varwidth \ "Exit Help RePlot Color of Color of Color of "] ## Add some pixels to account for right-left-size of window-manager ## decoration (about 6 pixels) and frame/widget borders for ## at least 4 buttons (4x4 pixels/widget). set minWinWidthPx [expr {20 + $minWinWidthPx}] ## Get the approx MIN HEIGHT based on ## 2 chars high for the '.fRbuttons' frame ## 1 char high for the '.fRfile' frame ## 1 char high for the '.fRtitle' frame ## 1 char high for the '.fRlogtype' frame ## 1 char high for the '.fRxaxis' frame ## 1 char high for the '.fRy1axis' frame ## 1 char high for the '.fRy2axis' frame ## 1 char high for the '.fRplotopts' frame ## 1 char high for the '.fRtics' frame ## 1 char high for the '.fRoutopts' frame ## 1 char high for the '.fRmsg' frame ## ## and add about 20 pixels for top-bottom window decoration -- ## and about 11x4 pixels for frame/widget borders of the 11 frames. set charHeightPx [font metrics fontTEMP_fixedwidth -linespace] set minWinHeightPx [expr {64 + ( 12 * $charHeightPx )} ] ## FOR TESTING: # puts "minWinWidthPx = $minWinWidthPx" # puts "minWinHeightPx = $minWinHeightPx" wm minsize . $minWinWidthPx $minWinHeightPx ## We allow the window to be resizable and we pack the canvas with ## '-fill both' so that the canvas can be enlarged by enlarging the ## window. ## If you want to make the window un-resizable, ## you can use the following statement. # wm resizable . 0 0 ## We can make the window un-resizable in the y direction, ## but allow it to be resizable in the x direction. wm resizable . 1 0 ##+#################################################################### ## Set a TEXT-ARRAY to hold text for buttons & labels on the GUI. ## NOTE: This can aid INTERNATIONALIZATION. This array can ## be set according to a nation/region parameter. ##+#################################################################### ## if { "$VARlocale" == "en"} ## For widgets in 'fRbuttons' frame: set aRtext(buttonEXIT) "Exit" set aRtext(buttonHELP) "Help" set aRtext(buttonPLOT) "RePlot" set aRtext(buttonCOLORLINE) "Color of Lines" set aRtext(buttonCOLORAXIS) "Color of Axes" set aRtext(buttonCOLORBKGD) "Color of Background" set aRtext(chkbuttYAXISunitsSAME) "Same Axis Units for Y1 and Y2" ## For widgets in 'fRfile' frame: set aRtext(labelFILENAME) "Data filename:" set aRtext(buttonGETFILE) "GetFilename" set aRtext(buttonVIEWFILE) "ViewTextFile" ## For widgets in 'fRtitle' frame: set aRtext(labelPLOTTITLE) "Plot title:" ## For widgets in 'fRlogtype' frame: set aRtext(labelLOGTYPE) "Log axes:" set aRtext(radbuttLOGX) "X" set aRtext(radbuttLOGY) "Y" set aRtext(radbuttLOGXY) "XY" set aRtext(radbuttNOLOG) "NoLog" ## For a checkbutton widget in the 'axis' frames: ## ** NOT IMPLEMENTED ** # set aRtext(chkbuttUSE) "Use:" ## For widgets in 'fRxaxis' frame: set aRtext(labelXCOLNUM) "Xcolumn#:" set aRtext(labelXMIN) "XaxisMin:" set aRtext(labelXMAX) "XaxisMax:" set aRtext(labelXTICcolnum) "XticLabelsCol#:" ## For widgets in 'fRy1axis' frame: set aRtext(labelY1COLNUM) "Y1column#:" set aRtext(labelY1MIN) "Y1axisMin:" set aRtext(labelY1MAX) "Y1axisMax:" set aRtext(labelLINETYPE) "LineType(1-29):" ## For widgets in 'fRy2axis' frame: set aRtext(labelY2COLNUM) "Y2column#:" set aRtext(labelY2MIN) "Y2axisMin:" set aRtext(labelY2MAX) "Y2axisMax:" ## For widgets in 'fRplotopts' frame: set aRtext(labelPLOTTYPE) "Plot type:" set aRtext(radbuttLINES) "Lines" set aRtext(radbuttPOINTS) "Points" set aRtext(radbuttLINESPOINTS) "Both" set aRtext(labelLINEWIDTH) " Line Width (1-6):" set aRtext(chkbuttGRID) "Grid?" set aRtext(chkbuttBORDER) "Border?" ## For widgets in 'fRtics' frame: set aRtext(labelXTICLABELangle) " XticLabelsAngle:" set aRtext(labelYTICLABELangle) " YticLabelsAngle:" set aRtext(chkbuttMINORTICS) "MinorTics?" ## For widgets in 'fRoutopts' frame: set aRtext(labelOUTTYPE) "Image file type:" set aRtext(radbuttGIF) "GIF" set aRtext(radbuttPNG) "PNG" set aRtext(radbuttJPG) "JPG" set aRtext(radbuttPS) "PSc" set aRtext(radbuttPSbw) "PSbw" set aRtext(radbuttSVG) "SVG" set aRtext(radbuttWXT) "WXT" set aRtext(buttonTESTimg) "TestImg" set aRtext(labelXPIXELS) " X pixels:" set aRtext(labelYPIXELS) " Y pixels:" ## END OF if { "$VARlocale" == "en"} ##+################################################################### ##+################################################################### ## DEFINE *ALL* THE FRAMES -- (top to bottom): ## ## - 'fRbuttons' contains button widgets -- 'Exit', 'Help', ## 'RePlot', some color-selector-buttons, ... ## - 'fRfile' contains 1 label & 1 entry & 1 button widget. ## - 'fRtitle' contains 1 label & 1 entry widget. ## - 'fRlogtype' contains 1 label & several radiobutton widgets. ## - 'fRxaxis' contains several label & entry widgets. ## - 'fRy1axis' contains several label & entry widgets. ## - 'fRy2axis' contains label & entry widgets. ## - 'fRplotopts' contains a group of radiobutton widgets ## and 1 pair of label & entry widgets. ## - 'fRoutopts' contains a group of radiobutton widgets ## and 2 pairs of label & entry widgets. ## - 'fRmsg' contains a label (or text) widget. ##+################################################################### ## FOR TESTING change 0 to 1: ## (Example1: To see appearance of frames when borders are drawn.) ## (Example2: To see sizes of frames for various '-fill' options.) ## (Example3: To see how frames expand as window is resized.) if {0} { set RELIEF_frame raised set BDwidthPx_frame 2 } else { set RELIEF_frame flat set BDwidthPx_frame 0 } frame .fRbuttons -relief $RELIEF_frame -bd $BDwidthPx_frame # frame .fRfile -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRfile -relief raised -bd 2 frame .fRtitle -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRlogtype -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRxaxis -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRy1axis -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRy2axis -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRplotopts -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRtics -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRoutopts -relief $RELIEF_frame -bd $BDwidthPx_frame frame .fRmsg -relief $RELIEF_frame -bd $BDwidthPx_frame ##+####################################################### ## PACK *ALL* the FRAMES. ##+####################################################### ## PACK THE FRAMES IN SEPARATELY, in order to ## experiment with different behaviors in window expansion. ##+####################################################### pack .fRbuttons \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRfile \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRtitle \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRlogtype \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRxaxis \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRy1axis \ -side top \ -anchor w \ -fill x \ -expand 0 pack .fRy2axis \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRplotopts \ -side top \ -anchor w \ -fill x \ -expand 0 pack .fRtics \ -side top \ -anchor w \ -fill x \ -expand 0 pack .fRoutopts \ -side top \ -anchor nw \ -fill x \ -expand 0 pack .fRmsg \ -side top \ -anchor nw \ -fill x \ -expand 0 ##+################################################################ ## The frames are defined and packed. ##+################################################################ ##+############################################################### ## START DEFINING & PACKING WIDGETS WITHIN THEIR FRAMES. ##+############################################################### ##+############################################################### ##+####################################################### ## IN THE 'fRbuttons' frame -- DEFINE ~8 BUTTON WIDGETs. ## THEN PACK EM. ##+####################################################### button .fRbuttons.buttEXIT \ -text "$aRtext(buttonEXIT)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command exit button .fRbuttons.buttHELP \ -text "$aRtext(buttonHELP)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command {popup_msgVarWithScroll .topHelp "$HELPtext" +10+10} button .fRbuttons.buttPLOT \ -text "$aRtext(buttonPLOT)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command replot button .fRbuttons.buttLINEcolor \ -text "$aRtext(buttonCOLORLINE)" \ -font fontTEMP_SMALL_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command {getset_color "line"} button .fRbuttons.buttAXIScolor \ -text "$aRtext(buttonCOLORAXIS)" \ -font fontTEMP_SMALL_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command {getset_color "axis"} ## If the axis (or points) color option is de-activated: # -command {popup_msgVarWithScroll .topHelp "This Axes color option is not implemented yet." +10+300} button .fRbuttons.buttBKGDcolor \ -text "$aRtext(buttonCOLORBKGD)" \ -font fontTEMP_SMALL_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command {getset_color "bkgd"} ##+######################################################## ## Make a grayed-out checkbutton to indicate that Y1 and Y2 ## are expected to use the same Y axis --- i.e. the same ## units and plotted using the same scaling factor. ## (The option to have 2 different y axes and scales ## could be implemented in a future version.) ##+######################################################## set SameAxisForY1andY2_0or1 1 checkbutton .fRbuttons.chkbuttYAXES \ -variable SameAxisForY1andY2_0or1 \ -text "$aRtext(chkbuttYAXISunitsSAME)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -selectcolor "$checkbuttBKGD" \ -relief $RELIEF_chkbutt_lo .fRbuttons.chkbuttYAXES configure -state disabled ##+######################################################## ## PACK the '.fRbuttons' widgets. ##+######################################################## pack .fRbuttons.buttEXIT \ .fRbuttons.buttHELP \ .fRbuttons.buttPLOT \ .fRbuttons.buttLINEcolor \ .fRbuttons.buttAXIScolor \ .fRbuttons.buttBKGDcolor \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRbuttons.chkbuttYAXES \ -side right \ -anchor e \ -fill none \ -expand 0 ##+######################################################## ## IN THE 'fRfile' frame -- ## DEFINE LABEL, ENTRY & BUTTON WIDGETs. THEN PACK EM. ##+######################################################## label .fRfile.lab \ -text "$aRtext(labelFILENAME)" \ -font fontTEMP_varwidth \ -padx $PADXpx_label \ -pady $PADYpx_label entry .fRfile.ent \ -textvariable DATAfilename \ -width 40 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry button .fRfile.buttGETFILE \ -text "$aRtext(buttonGETFILE)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -command get_filename button .fRfile.buttVIEWFILE \ -text "$aRtext(buttonVIEWFILE)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -command view_file ## PACK widgets in frame '.fRfile' ## --- individually, for expansion control. pack .fRfile.lab \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRfile.ent \ -side left \ -anchor w \ -fill x \ -expand 1 pack .fRfile.buttGETFILE \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRfile.buttVIEWFILE \ -side left \ -anchor w \ -fill none \ -expand 0 ##+######################################################## ## IN THE 'fRtitle' frame -- ## DEFINE LABEL, ENTRY WIDGETs. THEN PACK EM. ##+######################################################## label .fRtitle.lab \ -text "$aRtext(labelPLOTTITLE)" \ -font fontTEMP_varwidth \ -padx $PADXpx_label \ -pady $PADYpx_label entry .fRtitle.ent \ -textvariable PlotTITLE \ -width 40 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ## PACK widgets in frame '.fRtitle' ## --- individually, for expansion control. pack .fRtitle.lab \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRtitle.ent \ -side left \ -anchor w \ -fill x \ -expand 1 ##+####################################################### ## IN THE 'fRlogtype' frame -- DEFINE ## a LABEL WIDGET with several RADIOBUTTON widgets. ## THEN PACK THEM. ##+####################################################### label .fRlogtype.labelLOGTYPE \ -text "$aRtext(labelLOGTYPE)" \ -font fontTEMP_varwidth \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_lo radiobutton .fRlogtype.radbuttLOGX \ -text "$aRtext(radbuttLOGX)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARlogscale \ -value "X" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRlogtype.radbuttLOGY \ -text "$aRtext(radbuttLOGY)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARlogscale \ -value "Y" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRlogtype.radbuttLOGXY \ -text "$aRtext(radbuttLOGXY)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARlogscale \ -value "XY" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRlogtype.radbuttNOLOG \ -text "$aRtext(radbuttNOLOG)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARlogscale \ -value "NOLOG" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi ## PACK all the widgets in frame '.fRlogtype'. pack .fRlogtype.labelLOGTYPE \ .fRlogtype.radbuttLOGX \ .fRlogtype.radbuttLOGY \ .fRlogtype.radbuttLOGXY \ .fRlogtype.radbuttNOLOG \ -side left \ -anchor w \ -fill none \ -expand 0 ##+######################################################## ## IN THE 'fRxaxis' frame -- ## DEFINE LABEL & ENTRY WIDGETS for x-axis. ## AND PACK the widgets. ##+######################################################## ## Rather than adding another frame-level to keep ## entry fields lined up nicely, we try using a common ## width for the colnum, min, max labels for the entry fields. ## (This might result in some clipping of the labels ## for certain font choices.) set colWIDTHchars 9 set minWIDTHchars 9 set maxWIDTHchars 9 label .fRxaxis.labXCOLNUM \ -text "$aRtext(labelXCOLNUM)" \ -font fontTEMP_varwidth \ -width $colWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRxaxis.entXCOLNUM \ -textvariable Xcolnum \ -width 3 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+######################################################## ## DEFINE 2 LABEL & 2 ENTRY WIDGETs for x-axis limits. ##+######################################################## label .fRxaxis.labXmin \ -text "$aRtext(labelXMIN)" \ -font fontTEMP_varwidth \ -width $minWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRxaxis.entXmin \ -textvariable Xmin \ -width 7 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry label .fRxaxis.labXmax \ -text "$aRtext(labelXMAX)" \ -font fontTEMP_varwidth \ -width $maxWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRxaxis.entXmax \ -textvariable Xmax \ -width 7 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry label .fRxaxis.labXTICcolnum \ -text "$aRtext(labelXTICcolnum)" \ -font fontTEMP_varwidth \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRxaxis.entXTICcolnum \ -textvariable XTICcolnum \ -width 2 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+########################################### ## Define an ENTRY widget for the x-axis title. ##+########################################### entry .fRxaxis.entXTITLE \ -textvariable XaxisTITLE \ -width 45 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+######################################## ## PACK the widgets in frame '.fRxaxis' --- ## individually, for ease of experimentation ## with x-expansion of the entry widgets. ##+######################################## pack .fRxaxis.labXCOLNUM \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.entXCOLNUM \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.labXmin \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.entXmin \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.labXmax \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.entXmax \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.labXTICcolnum \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.entXTICcolnum \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRxaxis.entXTITLE \ -side left \ -anchor w \ -fill x \ -expand 1 ##+####################################################### ## IN THE 'fRy1axis' frame -- ## DEFINE LABEL & ENTRY WIDGETS for the y1-axis. ## THEN PACK the widgets. ##+####################################################### label .fRy1axis.labY1COLNUM \ -text "$aRtext(labelY1COLNUM)" \ -font fontTEMP_varwidth \ -width $colWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy1axis.entY1COLNUM \ -textvariable Y1colnum \ -width 3 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+####################################################### ## For the y1-axis min & max limits ## DEFINE 2 LABEL & 2 ENTRY WIDGETs. ##+####################################################### label .fRy1axis.labY1min \ -text "$aRtext(labelY1MIN)" \ -font fontTEMP_varwidth \ -width $minWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy1axis.entY1min \ -textvariable Y1min \ -width 7 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry label .fRy1axis.labY1max \ -text "$aRtext(labelY1MAX)" \ -font fontTEMP_varwidth \ -width $maxWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy1axis.entY1max \ -textvariable Y1max \ -width 7 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry label .fRy1axis.labLINETYPE \ -text "$aRtext(labelLINETYPE)" \ -font fontTEMP_varwidth \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy1axis.entLINETYPE \ -textvariable Y1linetype \ -width 2 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+####################################################### ## For the y1 axis title, DEFINE1 ENTRY WIDGET. ##+####################################################### entry .fRy1axis.entY1TITLE \ -textvariable Y1axisTITLE \ -width 45 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+####################################### ## PACK the widgets in frame '.fRy1axis' --- ## individually, for ease of experimentation ## with x-expansion of the entry widgets. ##+####################################### pack .fRy1axis.labY1COLNUM \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.entY1COLNUM \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.labY1min \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.entY1min \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.labY1max \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.entY1max \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.labLINETYPE \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.entLINETYPE \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy1axis.entY1TITLE \ -side left \ -anchor w \ -fill x \ -expand 1 ##+####################################################### ## IN THE 'fRy2axis' frame -- ## DEFINE LABEL & ENTRY WIDGETS for the y2-axis. ## THEN PACK the widgets. ##+####################################################### label .fRy2axis.labY2COLNUM \ -text "$aRtext(labelY2COLNUM)" \ -font fontTEMP_varwidth \ -width $colWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy2axis.entY2COLNUM \ -textvariable Y2colnum \ -width 3 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+####################################################### ## IN THE 'fRy2axis' frame -- for the y2-axis min & max limits ## DEFINE 2 LABEL & 2 ENTRY WIDGETs. THEN PACK EM. ##+####################################################### label .fRy2axis.labY2min \ -text "$aRtext(labelY2MIN)" \ -font fontTEMP_varwidth \ -width $minWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy2axis.entY2min \ -textvariable Y2min \ -width 7 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ## Until we implement allowing Y2 to have different scale from Y1, ## we do not use Y2min. Use Y1min instead. .fRy2axis.entY2min configure -state disabled label .fRy2axis.labY2max \ -text "$aRtext(labelY2MAX)" \ -font fontTEMP_varwidth \ -width $maxWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy2axis.entY2max \ -textvariable Y2max \ -width 7 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ## Until we implement allowing Y2 to have different scale from Y1, ## we do not use Y2max. Use Y1max instead. .fRy2axis.entY2max configure -state disabled label .fRy2axis.labLINETYPE \ -text "$aRtext(labelLINETYPE)" \ -font fontTEMP_varwidth \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify right \ -anchor e entry .fRy2axis.entLINETYPE \ -textvariable Y2linetype \ -width 2 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ##+####################################################### ## DEFINE 1 ENTRY WIDGET --- for the y2 axis title. ##+####################################################### entry .fRy2axis.entY2TITLE \ -textvariable Y2axisTITLE \ -width 45 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ## Until we implement allowing Y2 to have different scale from Y1, ## we do not use a title for Y2 (on the right side of the plot). .fRy2axis.entY2TITLE configure -state disabled ##+####################################### ## PACK the widgets in frame '.fRy2axis' --- ## individually, for experimentation with ## x-expansion of the entry widgets. ##+####################################### pack .fRy2axis.labY2COLNUM \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.entY2COLNUM \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.labY2min \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.entY2min \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.labY2max \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.entY2max \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.labLINETYPE \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.entLINETYPE \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRy2axis.entY2TITLE \ -side left \ -anchor w \ -fill x \ -expand 1 ##+####################################################### ## IN THE 'fRplotopts' frame -- DEFINE a LABEL and ## several RADIOBUTTON widgets, and a pair of ## a LABEL and ENTRY widgets. ## THEN PACK THEM. ##+####################################################### ## DEFINE a LABEL and RADIOBUTTONS for PLOT TYPE : ## (lines or points or both) label .fRplotopts.labelPLOTTYPE \ -text "$aRtext(labelPLOTTYPE)" \ -font fontTEMP_varwidth \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_lo radiobutton .fRplotopts.radbuttLINES \ -text "$aRtext(radbuttLINES)" \ -font fontTEMP_varwidth \ -anchor w \ -variable RADVARplottype \ -value "lines" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRplotopts.radbuttPOINTS \ -text "$aRtext(radbuttPOINTS)" \ -font fontTEMP_varwidth \ -anchor w \ -variable RADVARplottype \ -value "points" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRplotopts.radbuttLINESPOINTS \ -text "$aRtext(radbuttLINESPOINTS)" \ -font fontTEMP_varwidth \ -anchor w \ -variable RADVARplottype \ -value "linespoints" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi label .fRplotopts.labelLINEWIDTH \ -text "$aRtext(labelLINEWIDTH)" \ -font fontTEMP_varwidth \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_lo entry .fRplotopts.entLINEWIDTH \ -textvariable lineWIDTH \ -width 1 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry checkbutton .fRplotopts.chkbuttGRID \ -variable Grid_0or1 \ -text "$aRtext(chkbuttGRID)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -selectcolor "$checkbuttBKGD" \ -relief $RELIEF_chkbutt_lo checkbutton .fRplotopts.chkbuttBORDER \ -variable Border_0or1 \ -text "$aRtext(chkbuttBORDER)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -selectcolor "$checkbuttBKGD" \ -relief $RELIEF_chkbutt_lo ## PACK the widgets in frame '.fRplotopts'. pack .fRplotopts.labelPLOTTYPE \ .fRplotopts.radbuttLINES \ .fRplotopts.radbuttPOINTS \ .fRplotopts.radbuttLINESPOINTS \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRplotopts.labelLINEWIDTH \ .fRplotopts.entLINEWIDTH \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRplotopts.chkbuttGRID \ .fRplotopts.chkbuttBORDER \ -side left \ -anchor w \ -fill none \ -expand 0 ##+####################################################### ## IN THE 'fRtics' frame -- DEFINE a pair of LABEL and ## ENTRY widgets, and a CHECKBUTTON. ## THEN PACK THEM. ##+####################################################### set angleWIDTHchars 13 label .fRtics.labXTICLABELangle \ -text "$aRtext(labelXTICLABELangle)" \ -font fontTEMP_varwidth \ -width $angleWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify left \ -anchor w entry .fRtics.entXTICLABELangle \ -textvariable XTICLABELangle \ -width 3 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry label .fRtics.labYTICLABELangle \ -text "$aRtext(labelYTICLABELangle)" \ -font fontTEMP_varwidth \ -width $angleWIDTHchars \ -padx $PADXpx_label \ -pady $PADYpx_label \ -justify left \ -anchor w entry .fRtics.entYTICLABELangle \ -textvariable YTICLABELangle \ -width 3 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry checkbutton .fRtics.chkbuttMINORTICS \ -variable MinorTics_0or1 \ -text "$aRtext(chkbuttMINORTICS)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -selectcolor "$checkbuttBKGD" \ -relief $RELIEF_chkbutt_lo ## PACK the widgets in frame '.fRtics'. pack .fRtics.labXTICLABELangle \ .fRtics.entXTICLABELangle \ .fRtics.labYTICLABELangle \ .fRtics.entYTICLABELangle \ .fRtics.chkbuttMINORTICS \ -side left \ -anchor w \ -fill none \ -expand 0 ##+####################################################### ## IN THE 'fRoutopts' frame -- DEFINE 2 groups of ## a LABEL WIDGET with several RADIOBUTTON widgets. ## THEN PACK THEM. ##+####################################################### ## DEFINE a LABEL and RADIOBUTTONS for IMAGE OUTPUT TYPE : ## (gif or png or jpg or ps or svg) label .fRoutopts.labelOUTTYPE \ -text "$aRtext(labelOUTTYPE)" \ -font fontTEMP_varwidth \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_lo radiobutton .fRoutopts.radbuttGIF \ -text "$aRtext(radbuttGIF)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "gif" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRoutopts.radbuttPNG \ -text "$aRtext(radbuttPNG)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "png" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRoutopts.radbuttJPG \ -text "$aRtext(radbuttJPG)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "jpg" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRoutopts.radbuttPS \ -text "$aRtext(radbuttPS)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "ps" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRoutopts.radbuttPSbw \ -text "$aRtext(radbuttPSbw)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "psbw" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRoutopts.radbuttSVG \ -text "$aRtext(radbuttSVG)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "svg" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi radiobutton .fRoutopts.radbuttWXT \ -text "$aRtext(radbuttWXT)" \ -font fontTEMP_SMALL_varwidth \ -anchor w \ -variable RADVARoutimg \ -value "wxt" \ -selectcolor "$radiobuttBKGD" \ -padx $PADXpx_radbutt \ -pady $PADYpx_radbutt \ -bd $BDwidthPx_radbutt \ -relief $RELIEF_radbutt_hi button .fRoutopts.buttTESTimg \ -text "$aRtext(buttonTESTimg)" \ -font fontTEMP_varwidth \ -padx $PADXpx_button \ -pady $PADYpx_button \ -relief raised \ -bd $BDwidthPx_button \ -command display_test_img label .fRoutopts.labelXPIXELS \ -text "$aRtext(labelXPIXELS)" \ -font fontTEMP_varwidth \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_lo entry .fRoutopts.entXPIXELS \ -textvariable Xpixels \ -width 5 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry label .fRoutopts.labelYPIXELS \ -text "$aRtext(labelYPIXELS)" \ -font fontTEMP_varwidth \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_lo entry .fRoutopts.entYPIXELS \ -textvariable Ypixels \ -width 5 \ -font fontTEMP_fixedwidth \ -bg $entryBKGD \ -relief sunken \ -bd $BDwidthPx_entry ## PACK all the widgets in frame '.fRoutopts'. pack .fRoutopts.labelOUTTYPE \ .fRoutopts.radbuttGIF \ .fRoutopts.radbuttPNG \ .fRoutopts.radbuttJPG \ .fRoutopts.radbuttPS \ .fRoutopts.radbuttPSbw \ .fRoutopts.radbuttSVG \ .fRoutopts.radbuttWXT \ .fRoutopts.buttTESTimg \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRoutopts.labelXPIXELS \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRoutopts.entXPIXELS \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRoutopts.labelYPIXELS \ -side left \ -anchor w \ -fill none \ -expand 0 pack .fRoutopts.entYPIXELS \ -side left \ -anchor w \ -fill none \ -expand 0 ##+####################################################### ## IN THE 'fRmsg' frame -- DEFINE a LABEL (or TEXT) widget. ## THEN PACK IT. ##+####################################################### label .fRmsg.labelMSG \ -font fontTEMP_fixedwidth \ -bg "#33ff33" \ -justify left \ -anchor w \ -padx $PADXpx_label \ -pady $PADYpx_label \ -bd $BDwidthPx_label \ -relief $RELIEF_label_hi ## PACK the widgets in frame '.fRmsg'. pack .fRmsg.labelMSG \ -side left \ -anchor w \ -fill x \ -expand 1 ##+################################################################# ##+ Frames and their widgets are defined and packed. ##+################################################################# ##+################################################################# ## END OF MAIN GUI BUILDING SECTION. ##+################################################################# ##+################################################################# ##+################################################################## ##+################################################################## ## DEFINE BINDINGS -- for mouse/keboard actions: ##+################################################################## ##+################################################################## ## None, for now. ##+################################################################## ##+################################################################## ## DEFINE PROCEDURES: ## ## 'get_filename' - called by 'GetFilename' button ## (Uses the built-in Tk utility 'tk_getOpenFile'.) ## 'view_file' - called by 'ViewFile' button ## 'replot' - called by 'RePlot' button ## (Writes gnuplot script and executes it.) ## (Could (re)set contents of axis limits in entry widgets.) ## ## 'display_test_img' - called by the 'TestImg' button ## 'edit_inputs' - called by the 'replot' proc ## ## 'getset_color' - called by 'LineColor' 'AxisColor' 'BkgdColor' buttons ## 'update_color_button' - called by 'getset_color' proc and 3 times in the ## 'Additional GUI Initialization' section. ## ## 'popup_msgVarWithScroll' - called by 'Help' button to show HELPtext var. ## ##+################################################################## ##+################################################################## ##+#################################################################### ## PROC: 'get_filename' ##+#################################################################### ## PURPOSE: To load a filename into the DATAfilename global var. ## METHOD: Uses the built-in Tk utility 'tk_getOpenFile'. ## CALLED BY: button .fRfile.buttGETFILE ##+#################################################################### proc get_filename { } { global DATAfilename DIRin env ############################################# ## Get a plot-data file name. ############################################# set fName [tk_getOpenFile -parent . \ -title "Select Directory-and-Filename - of a plot-data file" \ -initialdir "$DIRin" ] ## FOR TESTING: # puts "fName : $fName" ################################ ## Check if fName var is empty. ################################ if {"$fName" == ""} {return} ##################################################### ## Put $fName in DATAfilename. Reset the DIRin var. ##################################################### if {[file exists "$fName"]} { set DATAfilename "$fName" ## Put the end of the filename in view. .fRfile.ent xview end set DIRin [ get_chars_before_last / in "$DATAfilename" ] } ## END OF if directory-exists } ## END of proc 'get_filename' ##+#################################################################### ## PROC: 'view_file' ##+#################################################################### ## PURPOSE: To start a text-file viewer on the filename in the ## DATAfilename global var. ## ## CALLED BY: button .fRfile.buttVIEWFILE ##+#################################################################### proc view_file {} { global DATAfilename TXTFILEviewer # catch {exec $TXTFILEviewer "$DATAfilename"} exec $TXTFILEviewer "$DATAfilename" } ## END of proc 'view_file' ##+#################################################################### ## PROC: 'replot' ##+#################################################################### ## PURPOSE: ## Builds a 'gnuplot' script using the parameters from the ## GUI and the data filename specified. ## ## Then executes that gnuplot-script and shows the resulting image ## file in an image viewer (set at the bottom of this Tk script) ## --- or, at least, tells the name of the output image file, in ## a message area of the GUI. ## ## Arguments: passed in Tcl-Tk global variables. ## ## CALLED BY: button .fRbuttons.buttPLOT ##+#################################################################### proc replot {} { global DATAfilename OUTscript IMGFILEprefix RADVARlogscale global PlotTITLE XaxisTITLE Y1axisTITLE Y2axisTITLE global Xcolnum Y1colnum Y2colnum XTICcolnum global Xmin Xmax Y1min Y1max Y2min Y2max Y1linetype Y2linetype global RADVARplottype lineWIDTH Grid_0or1 Border_0or1 global XTICLABELangle YTICLABELangle MinorTics_0or1 global RADVARoutimg GIFviewer PNGviewer JPGviewer PSviewer SVGviewer global Xpixels Ypixels global COLORLINEr COLORLINEg COLORLINEb COLORLINEhex global COLORBKGDr COLORBKGDg COLORBKGDb COLORBKGDhex global COLORAXISr COLORAXISg COLORAXISb COLORAXIShex global EDITcode ## FOR TESTING: # puts "\nFrom top of 'replot' proc:" # puts " Xmin is $Xmin" # puts " Xmax is $Xmax" ## Call a proc to check for invalid inputs, esp. in entry fields. edit_inputs if {$EDITcode > 0} {return} ## Prepare to make a NEW output gnuplot script. # catch {exec rm "$OUTscript"} catch {file delete "$OUTscript"} ## Open the output file and get its file handle. set SHout [open "$OUTscript" w] ## FOR TESTING: # puts "\nFrom top of 'replot' proc: $OUTscript opened." ##################################################### ## START writing the gnuplot script. ##################################################### ## Set the first line. puts $SHout "#!/usr/bin/gnuplot" ## Set a working directory for gnuplot. ## gnuplot may put 'extra' files here. puts $SHout "! cd /tmp" ## Set output (terminal) type and ## set a filename for the output image file. ## ## Common options for all bitmap terminals: ## set terminal XXX [size {int:x}, {int:y} ] [ {no]crop ] ## [font [ {str:name} [ {int:size} ] ] ## | [ "{str:path} [, (int:size} ]" ] ] ## [ [no]enhanced ] [ rounded | butt ] ## [ (color0) (color1) (color2) ... ] ## NOTE: ## 'The first color (color0) will be used for the background, ## the second color for the border, the third for the axes (when ## using 'set zeroaxis', for instance). All remaining colors are ## used for consecutive line types. The format for the color ## specification consists of a hex string preceded by the ## letter x, for example xFF0000 for red, and so on." ## ## 'enhanced' mode is to handle special text, such as subscripts, ## superscripts, and font changes. ## ## Reference: pages 342-344 of book "Gnuplot in Action" set xCOLORBKGDhex [string replace "$COLORBKGDhex" 0 0 "x"] set xCOLORAXIShex [string replace "$COLORAXIShex" 0 0 "x"] if {"$RADVARoutimg" == "gif"} { puts $SHout "set terminal gif size $Xpixels , $Ypixels \ nocrop noenhanced butt $xCOLORBKGDhex $xCOLORAXIShex $xCOLORAXIShex" set IMGfile "${IMGFILEprefix}.gif" set IMGviewer "$GIFviewer" } if {"$RADVARoutimg" == "png"} { puts $SHout "set terminal png size $Xpixels , $Ypixels \ nocrop noenhanced butt $xCOLORBKGDhex $xCOLORAXIShex $xCOLORAXIShex" set IMGfile "${IMGFILEprefix}.png" set IMGviewer "$PNGviewer" } if {"$RADVARoutimg" == "jpg"} { puts $SHout "set terminal jpeg size $Xpixels , $Ypixels \ nocrop noenhanced butt $xCOLORBKGDhex $xCOLORAXIShex $xCOLORAXIShex" set IMGfile "${IMGFILEprefix}.jpg" set IMGviewer "$JPGviewer" } ########################################## ## Common options for Postscript terminal: ## set terminal postscript [landscape | portrait | eps ] ## [ color | mono ] [ blacktext | colortext ] ## [ simplex | duplex | defaultplex ] ## [ size {flt:x}[in|cm], {flt:y}[in,cm] ] ## [font [ {str:name} [ {int:size} ] ] ## [ [no]enhanced ] [ rounded | butt ] ## [ solid | dashed ] ## [ linewidth | lw {flt:factor} ] ## [ dashlength | dl {flt:factor} ] if {"$RADVARoutimg" == "ps"} { puts $SHout "set terminal postscript landscape color colortext simplex \ noenhanced butt dashed size 8.0in, 6.0in" set IMGfile "${IMGFILEprefix}.ps" set IMGviewer "$PSviewer" } if {"$RADVARoutimg" == "psbw"} { puts $SHout "set terminal postscript landscape mono blacktext simplex \ noenhanced butt dashed size 8.0in, 6.0in" set IMGfile "${IMGFILEprefix}.ps" set IMGviewer "$PSviewer" } ########################################## ## Common options for SVG (scalable vector graphics) terminal: ## set terminal svg [ size {int:x},{int:y} [ fixed | dynamic ] ] ## [font "{str:name} [, {int:size} ]" ] ## [fontfile "{str:filename}" ] ## [ [no]enhanced ] [ rounded | butt ] ## [ linewidth {flt:factor} ] if {"$RADVARoutimg" == "svg"} { puts $SHout "set terminal svg size $Xpixels , $Ypixels dynamic \ noenhanced butt" set IMGfile "${IMGFILEprefix}.svg" set IMGviewer "$SVGviewer" } if {"$RADVARoutimg" == "wxt"} { puts $SHout "set terminal wxt persist title \"WXT terminal window\"" set IMGfile "" set IMGviewer "" } if {"$IMGfile" != ""} { puts $SHout "set output '$IMGfile'" } ################################### ## Set plot title. puts $SHout "set title '$PlotTITLE'" ############################################# ## Set TIMESTAMP (at bottom-left of plot): ## Y=yyyy b=mmm d=dd a=day-of-week HMS=hours-mins-secs puts $SHout "set timestamp '%Y %b %d %a %H:%M:%S'" ##################################### ## Set axis labels. puts $SHout "set xlabel '$XaxisTITLE'" puts $SHout "set ylabel '$Y1axisTITLE'" ## If/when we allow Y2 to have a different scale from Y1, ## then we will use a Y2 title (on the right side of the plot). # if {"$Y2colnum" != ""} { # puts $SHout "set y2label '$Y2axisTITLE'" # } ##################################### ## Set log scale type --- x or y or xy. if {"$RADVARlogscale" == "X"} { puts $SHout "set logscale x" } elseif {"$RADVARlogscale" == "Y"} { puts $SHout "set logscale y" } elseif {"$RADVARlogscale" == "XY"} { puts $SHout "set logscale" } ##################################### ## Set axis limits. puts $SHout "set xrange \[ $Xmin : $Xmax \]" puts $SHout "set yrange \[ $Y1min : $Y1max \]" ## If we allow different scales for y1 and y2 (someday), ## we should implement appropriate gnuplot statements here. # if {"$Y2colnum" != ""} { # puts $SHout "set y2range \[ $Y2min : $Y2max \]" ??? # } ##################################### ## Set x-axis, y-axis tic marks. ## Example of setting tic-marks manually: ## set xtics 0, 5 , 100 ## set ytics 0, 5 , 100 puts $SHout "set xtics rotate by $XTICLABELangle" puts $SHout "set ytics rotate by $YTICLABELangle" ################################################## ## Set x-and-y-axis MINOR tic marks, if requested. if {$MinorTics_0or1 == 1} { puts $SHout "set mxtics" puts $SHout "set mytics" # puts $SHout "set mxtics 5" # puts $SHout "set mytics 5" } #################################### ## Force vertical axis thru x=0. puts $SHout "set xzeroaxis" ################################### ## Force horizontal axis thru y=0. puts $SHout "set yzeroaxis" ################################### ## Set GRID, if requested. if {$Grid_0or1 == 1} { puts $SHout "set grid xtics ytics lt 0 lw 1" } ################################### ## Set BORDER, according to checkbutton setting. ## 1=bottom, 2=left, 4=top, 8=right ## 3 = 1 + 2 = left and bottom borders ## 15 = all borders (left,right,top,bottom) if {$Border_0or1 == 1} { puts $SHout "set border 15" } else { puts $SHout "unset border" ## Alternatives: # puts $SHout "set border 3" # puts $SHout "set border 0" (zero valid?) } ################################### ## Set a PLOTTYPE var to be used in the plot command. if {"$RADVARplottype" == "lines"} { set PLOTTYPE "with lines linewidth $lineWIDTH linecolor rgb '$COLORLINEhex'" } if {"$RADVARplottype" == "points"} { set PLOTTYPE "with points" } if {"$RADVARplottype" == "linespoints"} { set PLOTTYPE "with linespoints linewidth $lineWIDTH linecolor rgb '$COLORLINEhex'" } ############################################## ## Request PLOT LEGEND a.k.a. 'key' --- or not. ## Options: ## set nokey ## set key top right ## set key bottom right ## set key top left ## set key bottom left puts $SHout "set nokey" ###################### ## The PLOT COMMAND(s): ## if {$XTICcolnum != ""} { set COLSstr "$Xcolnum:$Y1colnum:xtic($XTICcolnum)" } else { set COLSstr "$Xcolnum:$Y1colnum" } if {"$Y2colnum" != ""} { puts $SHout "plot '$DATAfilename' using $COLSstr $PLOTTYPE linetype $Y1linetype \\" } else { puts $SHout "plot '$DATAfilename' using $COLSstr $PLOTTYPE linetype $Y1linetype" } ## To add a 2nd Y-plot, add a back-slash to the line above and ## MOVE the lines below (including the leading comma) underneath ## the line above, after removing the leading '#' comment indicators. if {"$Y2colnum" != ""} { puts $SHout ", '$DATAfilename' using $Xcolnum:$Y2colnum $PLOTTYPE linetype $Y2linetype" } ################################### ## COULD ADD A LABEL anywhere on the plot, ## via an added entry field or two on the GUI: ## # set label 'A plot note can go here.' at 1000,-2 center ## ## If your x-axis went from 0 to 2000, then '1000,-2 center' would locate the ## label below the x-axis (because of '-2') and just about centered in the ## x-direction on the plot (because of '1000' and 'center'). ##################################### ## Set command to view the image plot. ## The exclamation point tells gnuplot to pass the command to ## a shell (a command interpreter for the operating system). if {"$IMGfile" != ""} { puts $SHout "! $IMGviewer $IMGfile &" } ################################## ## Close the gnuplot script file. close $SHout ################################################# ## Put an 'outputs-location' message in the tkGUI, ## BEFORE executing the plot. if {"$IMGfile" != ""} { .fRmsg.labelMSG configure -text \ "Gnuplot script is written to $OUTscript --- image to $IMGfile." } else { .fRmsg.labelMSG configure -text \ "Gnuplot script is written to $OUTscript --- image to terminal window." } update ################################################### ## Execute the gnuplot script. ## (May add some error code checking later.) catch {exec chmod 755 "$OUTscript"} catch {exec "$OUTscript"} } ## END of proc 'replot' ##+#################################################################### ## PROC: 'display_test_img' ##+##################################################################### ## PURPOSE: Displays a gnuplot test image for the chosen ## terminal (image) type. ## ## CALLED BY: .fRoutopts.buttTESTimg ##+##################################################################### proc display_test_img {} { global OUTscript IMGFILEprefix global RADVARoutimg GIFviewer PNGviewer JPGviewer PSviewer SVGviewer global Xpixels Ypixels ## Prepare to make a NEW output gnuplot script. # catch {exec rm "$OUTscript"} catch {file delete "$OUTscript"} ## Open the output file and get its file handle. set SHout [open "$OUTscript" w] ##################################################### ## START writing the gnuplot script. ##################################################### ## Set the first line. puts $SHout "#!/usr/bin/gnuplot" ## Set a working directory for gnuplot. ## gnuplot may put 'extra' files here. puts $SHout "! cd /tmp" ## Set output (terminal) type and ## set a filename for the output image file. if {"$RADVARoutimg" == "gif"} { puts $SHout "set terminal gif size $Xpixels , $Ypixels" set IMGfile "${IMGFILEprefix}.gif" set IMGviewer "$GIFviewer" } if {"$RADVARoutimg" == "png"} { puts $SHout "set terminal png size $Xpixels , $Ypixels" set IMGfile "${IMGFILEprefix}.png" set IMGviewer "$PNGviewer" } if {"$RADVARoutimg" == "jpg"} { puts $SHout "set terminal jpeg size $Xpixels , $Ypixels" set IMGfile "${IMGFILEprefix}.jpg" set IMGviewer "$JPGviewer" } if {"$RADVARoutimg" == "ps"} { puts $SHout "set terminal postscript landscape colortext simplex \ noenhanced butt dashed size 8.0in, 6.0in" set IMGfile "${IMGFILEprefix}.ps" set IMGviewer "$PSviewer" } if {"$RADVARoutimg" == "psbw"} { puts $SHout "set terminal postscript landscape mono blacktext simplex \ noenhanced butt dashed size 8.0in, 6.0in" set IMGfile "${IMGFILEprefix}.ps" set IMGviewer "$PSviewer" } if {"$RADVARoutimg" == "svg"} { puts $SHout "set terminal svg size $Xpixels , $Ypixels" set IMGfile "${IMGFILEprefix}.svg" set IMGviewer "$SVGviewer" } if {"$RADVARoutimg" == "wxt"} { puts $SHout "set terminal wxt persist title \"WXT terminal window\"" set IMGfile "" set IMGviewer "" } if {"$IMGfile" != ""} { puts $SHout "set output '$IMGfile'" } puts $SHout "test" ##################################### ## Set command to view the image plot. ## The exclamation point tells gnuplot to pass the command to ## a shell (a command interpreter for the operating system). if {"$IMGfile" != ""} { puts $SHout "! $IMGviewer $IMGfile &" } ################################## ## Close the gnuplot script file. close $SHout ################################################# ## Put an 'outputs-location' message in the tkGUI, ## BEFORE executing the plot. if {"$IMGfile" != ""} { .fRmsg.labelMSG configure -text \ "Gnuplot script is written to $OUTscript --- image to $IMGfile." } else { .fRmsg.labelMSG configure -text \ "Gnuplot script is written to $OUTscript --- image to terminal window." } update ################################################### ## Execute the gnuplot script. ## (May add some error code checking later.) catch {exec chmod 755 "$OUTscript"} catch {exec "$OUTscript"} } ## END of proc 'display_test_img' ##+#################################################################### ## PROC: 'edit_inputs' ##+##################################################################### ## PURPOSE: ## ## CALLED BY: proc 'replot' ##+##################################################################### proc edit_inputs {} { global Xcolnum Y1colnum Y2colnum global Xmin Xmax Y1min Y1max Y2min Y2max global Y1linetype Y2linetype global lineWIDTH XTICLABELangle YTICLABELangle global Xpixels Ypixels ## We could do without this EDITcode variable, by using ## a code with the 'return' statement. But using this ## code variable is a little more self-documenting. global EDITcode set EDITcode 0 ####################################################### ## Remove trailing and leading blanks (if any) from the ## user entries in the 'entry' widgets. ####################################################### set Xcolnum [string trim $Xcolnum] set Y1colnum [string trim $Y1colnum] set Y2colnum [string trim $Y2colnum] set Xmin [string trim $Xmin] set Y1min [string trim $Y1min] set Y2min [string trim $Y2min] set Xmax [string trim $Xmax] set Y1max [string trim $Y1max] set Y2max [string trim $Y2max] set lineWIDTH [string trim $lineWIDTH] set XTICLABELangle [string trim $XTICLABELangle] set YTICLABELangle [string trim $YTICLABELangle] set Xpixels [string trim $Xpixels] set Ypixels [string trim $Ypixels] ########################################################## ## Check that Xcolnum, Y1colum are integers --- and that ## Y2colnum is an integer, if it is not blank (null). ########################################################## if {![string is integer -strict "$Xcolnum"]} { popup_msgVarWithScroll .topErr "X Column Number is NOT INTEGER." +10+10 set EDITcode 1 return } if {![string is integer -strict "$Y1colnum"]} { popup_msgVarWithScroll .topErr "Y1 Column Number is NOT INTEGER." +10+10 set EDITcode 1 return } if {"$Y2colnum" != ""} { if {![string is integer -strict "$Y2colnum"]} { popup_msgVarWithScroll .topErr "Y2 column Number is NOT INTEGER." +10+10 set EDITcode 1 return } } ######################################################################### ## Check that Xmin,Xmax,Y1min,Y1max are NOT blank. ######################################################################### set MUSTBEmsg "Must be '*' or a 'real' number." if {"$Xmin" == ""} { popup_msgVarWithScroll .topErr "Xmin is blank. $MUSTBEmsg" +10+10 set EDITcode 1 return } if {"$Xmax" == ""} { popup_msgVarWithScroll .topErr "Xmax is blank. $MUSTBEmsg" +10+10 set EDITcode 1 return } if {"$Y1min" == ""} { popup_msgVarWithScroll .topErr "Y1min is blank. $MUSTBEmsg" +10+10 set EDITcode 1 return } if {"$Y1max" == ""} { popup_msgVarWithScroll .topErr "Y1max is blank. $MUSTBEmsg" +10+10 set EDITcode 1 return } ######################################################################## ## If Y2colnum is not blank, check that Y2min,Y2max are NOT blank. ######################################################################## if {"$Y2colnum" != ""} { if {"$Y2min" == ""} { popup_msgVarWithScroll .topErr "Y2min is blank. $MUSTBEmsg" +10+10 set EDITcode 1 return } if {"$Y2max" == ""} { popup_msgVarWithScroll .topErr "Y2max is blank. $MUSTBEmsg" +10+10 set EDITcode 1 return } } ######################################################################### ## Check that Xmin,Xmax,Y1min,Y1max are asterisk-only (*) ## OR 'real' numbers. ######################################################################### ## Implemented using 'string is double'. Some sample test results: ## % string is double "-100.00" ## 1 ## % string is double "abc" ## 0 ## % string is double "-2.5e-3" ## 1 ## % string is double "-2.5E-3" ## 1 ## % string is double "-2.5D-3" ## 0 ######################################################################### set NUMERICmsg "does not appear to be numeric. Use chars '0123456789-.eE'." if {"$Xmin" != "*"} { if {![string is double "$Xmin"]} { popup_msgVarWithScroll .topErr "Xmin $NUMERICmsg" +10+10 set EDITcode 1 return } } if {"$Xmax" != "*"} { if {![string is double "$Xmax"]} { popup_msgVarWithScroll .topErr "Xmax $NUMERICmsg" +10+10 set EDITcode 1 return } } if {"$Y1min" != "*"} { if {![string is double "$Y1min"]} { popup_msgVarWithScroll .topErr "Y1min $NUMERICmsg" +10+10 set EDITcode 1 return } } if {"$Y1max" != "*"} { if {![string is double "$Y1max"]} { popup_msgVarWithScroll .topErr "Y1max $NUMERICmsg" +10+10 set EDITcode 1 return } } ######################################################################## ## If Y2colnum is not blank, check that Y2min,Y2max are asterisk-only (*) ## OR 'real' numbers. ######################################################################## ## Implemented crudely. ######################################################################### if {"$Y2colnum" != ""} { if {"$Y2min" != "*"} { if {![string is double "$Y2min"]} { popup_msgVarWithScroll .topErr "Y2min $NUMERICmsg" +10+10 set EDITcode 1 return } } if {"$Y2max" != "*"} { if {![string is double "$Y2max"]} { popup_msgVarWithScroll .topErr "Y2max $NUMERICmsg" +10+10 set EDITcode 1 return } } } #################################################################### ## Check that Y1linetype Y2linetype are not blank. #################################################################### if {"$Y1linetype" == ""} { popup_msgVarWithScroll .topErr "Y1 LINE TYPE is blank. Should be integer: -1, 0, 1-29." +10+10 set EDITcode 1 return } if {"$Y2linetype" == ""} { popup_msgVarWithScroll .topErr "Y2 LINE TYPE is blank. Should be integer: -1, 0, 1-29." +10+10 set EDITcode 1 return } #################################################################### ## Check that Y1linetype Y2linetype are integers. #################################################################### if {![string is integer -strict "$Y1linetype"]} { popup_msgVarWithScroll .topErr "Y1 LINE TYPE is NOT INTEGER." +10+10 set EDITcode 1 return } if {![string is integer -strict "$Y2linetype"]} { popup_msgVarWithScroll .topErr "Y2 LINE TYPE is NOT INTEGER." +10+10 set EDITcode 1 return } #################################################################### ## Check that lineWIDTH, XTICLABELangle, XTICLABELangle are not blank. #################################################################### if {"$lineWIDTH" == ""} { popup_msgVarWithScroll .topErr "Line WIDTH is blank. Should be numeric." +10+10 set EDITcode 1 return } if {"$XTICLABELangle" == ""} { popup_msgVarWithScroll .topErr "X Tic Label ANGLE is blank. Should be numeric." +10+10 set EDITcode 1 return } if {"$YTICLABELangle" == ""} { popup_msgVarWithScroll .topErr "Y Tic Label ANGLE is blank. Should be numeric." +10+10 set EDITcode 1 return } #################################################################### ## Check that lineWIDTH, XTICLABELangle, XTICLABELangle are integers. #################################################################### if {![string is integer -strict "$lineWIDTH"]} { popup_msgVarWithScroll .topErr "Line WIDTH is NOT INTEGER." +10+10 set EDITcode 1 return } if {![string is integer -strict "$XTICLABELangle"]} { popup_msgVarWithScroll .topErr "X Tic Label ANGLE is NOT INTEGER." +10+10 set EDITcode 1 return } if {![string is integer -strict "$YTICLABELangle"]} { popup_msgVarWithScroll .topErr "Y Tic Label ANGLE is NOT INTEGER." +10+10 set EDITcode 1 return } #################################################################### ## Check that Xpixels, Ypixels are not blank. #################################################################### if {"$Xpixels" == ""} { popup_msgVarWithScroll .topErr "Xpixels is blank. Should be integer." +10+10 set EDITcode 1 return } if {"$Ypixels" == ""} { popup_msgVarWithScroll .topErr "Ypixels is blank. Should be integer." +10+10 set EDITcode 1 return } ########################################################## ## Check that Xpixels, Ypixels are integers. ########################################################## if {![string is integer -strict "$Xpixels"]} { popup_msgVarWithScroll .topErr "Xpixels is NOT INTEGER." +10+10 set EDITcode 1 return } if {![string is integer -strict "$Ypixels"]} { popup_msgVarWithScroll .topErr "Ypixels is NOT INTEGER." +10+10 set EDITcode 1 return } } ## END of proc 'edit_inputs' ##+#################################################################### ## PROC: 'getset_color' ##+##################################################################### ## PURPOSE: ## ## This procedure is invoked to get an RGB triplet ## via 3 RGB slider bars on the FE Color Selector GUI. ## ## Uses that RGB value to set the color in variables determined ## by the 'colorID' string passed to this proc. ## ID Examples: 'line', 'bkgd', 'axis' ## ## Arguments: none ## ## CALLED BY: .fRbuttons.buttLINEcolor button ##+##################################################################### proc getset_color {colorID} { global COLORLINEr COLORLINEg COLORLINEb COLORLINEhex global COLORBKGDr COLORBKGDg COLORBKGDb COLORBKGDhex global COLORAXISr COLORAXISg COLORAXISb COLORAXIShex global ColorSelectorScript if {"$colorID" == "line"} { set tempCOLORr $COLORLINEr set tempCOLORg $COLORLINEg set tempCOLORb $COLORLINEb set tempCOLORhex $COLORLINEhex } elseif {"$colorID" == "bkgd"} { set tempCOLORr $COLORBKGDr set tempCOLORg $COLORBKGDg set tempCOLORb $COLORBKGDb set tempCOLORhex $COLORBKGDhex } elseif {"$colorID" == "axis"} { set tempCOLORr $COLORAXISr set tempCOLORg $COLORAXISg set tempCOLORb $COLORAXISb set tempCOLORhex $COLORAXIShex } else { ## Seems to be an invalid colorID. return } ## FOR TESTING: # puts "tempCOLORr: $tempCOLORr" # puts "tempCOLORg: $tempCOLORb" # puts "tempCOLORb: $tempCOLORb" set TEMPrgb [ exec $ColorSelectorScript $tempCOLORr $tempCOLORg $tempCOLORb] ## FOR TESTING: # puts "TEMPrgb: $TEMPrgb" if { "$TEMPrgb" == "" } { return } scan $TEMPrgb "%s %s %s %s" r255 g255 b255 hexRGB if {"$colorID" == "line"} { set COLORLINEhex "#$hexRGB" set COLORLINEr $r255 set COLORLINEg $g255 set COLORLINEb $b255 } elseif {"$colorID" == "bkgd"} { set COLORBKGDhex "#$hexRGB" set COLORBKGDr $r255 set COLORBKGDg $g255 set COLORBKGDb $b255 } elseif {"$colorID" == "axis"} { set COLORAXIShex "#$hexRGB" set COLORAXISr $r255 set COLORAXISg $g255 set COLORAXISb $b255 } else { return } ## Set color of the indicated color button. update_color_button $colorID } ## END OF PROC 'getset_color' ##+##################################################################### ## PROC 'update_color_button' ##+##################################################################### ## PURPOSE: ## This procedure is invoked to set the background color of the ## color button, indicated by the 'colorID' string, ## to its currently set 'colorID' color --- and sets ## foreground color, for text on the button, to a suitable black or ## white color, so that the label text is readable. ## ## Arguments: global color vars ## ## CALLED BY: in 2 places: ## in proc 'getset_color' ## and in the additional-GUI-initialization section at ## the bottom of this script. ##+##################################################################### proc update_color_button {colorID} { global COLORLINEr COLORLINEg COLORLINEb COLORLINEhex global COLORBKGDr COLORBKGDg COLORBKGDb COLORBKGDhex global COLORAXISr COLORAXISg COLORAXISb COLORAXIShex # set colorBREAK 300 set colorBREAK 250 if {"$colorID" == "line"} { .fRbuttons.buttLINEcolor configure -bg $COLORLINEhex set sumCOLOR1 [expr {$COLORLINEr + $COLORLINEg + $COLORLINEb}] if {$sumCOLOR1 > $colorBREAK} { .fRbuttons.buttLINEcolor configure -fg "#000000" } else { .fRbuttons.buttLINEcolor configure -fg "#ffffff" } } elseif {"$colorID" == "bkgd"} { .fRbuttons.buttBKGDcolor configure -bg $COLORBKGDhex set sumCOLOR1 [expr {$COLORBKGDr + $COLORBKGDg + $COLORBKGDb}] if {$sumCOLOR1 > $colorBREAK} { .fRbuttons.buttBKGDcolor configure -fg "#000000" } else { .fRbuttons.buttBKGDcolor configure -fg "#ffffff" } } elseif {"$colorID" == "axis"} { .fRbuttons.buttAXIScolor configure -bg $COLORAXIShex set sumCOLOR1 [expr {$COLORAXISr + $COLORAXISg + $COLORAXISb}] if {$sumCOLOR1 > $colorBREAK} { .fRbuttons.buttAXIScolor configure -fg "#000000" } else { .fRbuttons.buttAXIScolor configure -fg "#ffffff" } } else { ## Seems to be an invalid colorID. return } } ## END OF PROC 'update_color_button' ##+######################################################################## ## PROC 'popup_msgVarWithScroll' ##+######################################################################## ## PURPOSE: Report help or error conditions to the user. ## ## We do not use focus,grab,tkwait in this proc, ## because we use it to show help when the GUI is idle, ## and we may want the user to be able to keep the Help ## window open while doing some other things with the GUI ## such as putting a filename in the filename entry field ## or clicking on a radiobutton. ## ## For a similar proc with focus-grab-tkwait added, ## see the proc 'popup_msgVarWithScroll_wait' in a ## 3DterrainGeneratorExaminer Tk script. ## ## REFERENCE: page 602 of 'Practical Programming in Tcl and Tk', ## 4th edition, by Welch, Jones, Hobbs. ## ## ARGUMENTS: A toplevel frame name (such as .fRhelp or .fRerrmsg) ## and a variable holding text (many lines, if needed). ## ## CALLED BY: 'help' button ##+######################################################################## ## To have more control over the formatting of the message (esp. ## words per line), we use this 'toplevel-text' method, ## rather than the 'tk_dialog' method -- like on page 574 of the book ## by Hattie Schroeder & Mike Doyel,'Interactive Web Applications ## with Tcl/Tk', Appendix A "ED, the Tcl Code Editor". ##+######################################################################## proc popup_msgVarWithScroll { toplevName VARtext ULloc} { ## global fontTEMP_varwidth #; Not needed. 'wish' makes this global. ## global env # bell # bell ################################################# ## Set VARwidth & VARheight from $VARtext. ################################################# ## To get VARheight, ## split at '\n' (newlines) and count 'lines'. ################################################# set VARlist [ split $VARtext "\n" ] ## For testing: # puts "VARlist: $VARlist" set VARheight [ llength $VARlist ] ## For testing: # puts "VARheight: $VARheight" ################################################# ## To get VARwidth, ## loop through the 'lines' getting length ## of each; save max. ################################################# set VARwidth 0 ############################################# ## LOOK AT EACH LINE IN THE LIST. ############################################# foreach line $VARlist { ############################################# ## Get the length of the line. ############################################# set LINEwidth [ string length $line ] if { $LINEwidth > $VARwidth } { set VARwidth $LINEwidth } } ## END OF foreach line $VARlist ## For testing: # puts "VARwidth: $VARwidth" ############################################################### ## NOTE: VARwidth works for a fixed-width font used for the ## text widget ... BUT the programmer may need to be ## careful that the contents of VARtext are all ## countable characters by the 'string length' command. ############################################################### ##################################### ## SETUP 'TOP LEVEL' HELP WINDOW. ##################################### catch {destroy $toplevName} toplevel $toplevName # wm geometry $toplevName 600x400+100+50 # wm geometry $toplevName +100+50 wm geometry $toplevName $ULloc wm title $toplevName "Note" # wm title $toplevName "Note to $env(USER)" wm iconname $toplevName "Note" ##################################### ## In the frame '$toplevName' - ## DEFINE THE TEXT WIDGET and ## its two scrollbars --- and ## DEFINE an OK BUTTON widget. ##################################### if {$VARheight > 10} { text $toplevName.text \ -wrap none \ -font fontTEMP_varwidth \ -width $VARwidth \ -height $VARheight \ -bg "#f0f0f0" \ -relief raised \ -bd 2 \ -yscrollcommand "$toplevName.scrolly set" \ -xscrollcommand "$toplevName.scrollx set" scrollbar $toplevName.scrolly \ -orient vertical \ -command "$toplevName.text yview" scrollbar $toplevName.scrollx \ -orient horizontal \ -command "$toplevName.text xview" } else { text $toplevName.text \ -wrap none \ -font fontTEMP_varwidth \ -width $VARwidth \ -height $VARheight \ -bg "#f0f0f0" \ -relief raised \ -bd 2 } button $toplevName.butt \ -text "OK" \ -font fontTEMP_varwidth \ -command "destroy $toplevName" ############################################### ## PACK *ALL* the widgets in frame '$toplevName'. ############################################### ## Pack the bottom button BEFORE the ## bottom x-scrollbar widget, pack $toplevName.butt \ -side bottom \ -anchor center \ -fill none \ -expand 0 if {$VARheight > 10} { ## Pack the scrollbars BEFORE the text widget, ## so that the text does not monopolize the space. pack $toplevName.scrolly \ -side right \ -anchor center \ -fill y \ -expand 0 ## DO NOT USE '-expand 1' HERE on the Y-scrollbar. ## THAT ALLOWS Y-SCROLLBAR TO EXPAND AND PUTS ## BLANK SPACE BETWEEN Y-SCROLLBAR & THE TEXT AREA. pack $toplevName.scrollx \ -side bottom \ -anchor center \ -fill x \ -expand 0 ## DO NOT USE '-expand 1' HERE on the X-scrollbar. ## THAT KEEPS THE TEXT AREA FROM EXPANDING. pack $toplevName.text \ -side top \ -anchor center \ -fill both \ -expand 1 } else { pack $toplevName.text \ -side top \ -anchor center \ -fill both \ -expand 1 } ##################################### ## LOAD MSG INTO TEXT WIDGET. ##################################### ## $toplevName.text delete 1.0 end $toplevName.text insert end $VARtext $toplevName.text configure -state disabled } ## END OF PROC 'popup_msgVarWithScroll' ##+######################## ## END of PROC definitions. ##+######################## ##+##################################################### ##+##################################################### ## ADDITIONAL GUI INITIALIZATION SECTION: ##+##################################################### ##+##################################################### ##+##################################################### ## Set the DIRECTORY variable to be used to specify ## the location of OUTPUT image files --- and the last ## gnuplot script used to make an image file. ##+##################################################### # set DIRout "$env(HOME)" set DIRout "/tmp" ##+##################################################### ## Set the full-name of the RGB COLOR-SELECTOR Tk script ## that is used in several procs above. ##+##################################################### ## FOR TESTING: # puts "argv0: $argv0" set DIRthisScript "[file dirname $argv0]" ## For ease of testing in a Linux/Unix terminal and located at the ## directory containing this Tk script. Set the full directory name. if {"$DIRthisScript" == "."} { set DIRthisScript "[pwd]" } set DIRupOne "[file dirname "$DIRthisScript"]" set DIRupTwo "[file dirname "$DIRupOne"]" set ColorSelectorScript "$DIRupTwo/SELECTORtools/tkRGBselector/sho_colorvals_via_sliders3rgb.tk" ## An alternative: Put the RGB color-selector Tk script in the ## same directory as this Tk script and uncomment the following. # set ColorSelectorScript "$DIRthisScript/sho_colorvals_via_sliders3rgb.tk" ##+##################################################### ## Set the DIRECTORY variable to be used to specify ## a starting location to look for INPUT data files. ##+##################################################### # set DIRin "/tmp" # set DIRin "$env(HOME)" set DIRin "$DIRthisScript" ##+##################################################### ## Set a filename for the OUTPUT GNUPLOT SCRIPT(s). ##+##################################################### set userID "$env(USER)" set OUTscript "$DIRout/${userID}_gnuplot.sh" ##+##################################################### ## Set a file 'prefix' for the OUTPUT IMAGE FILE(s). ##+##################################################### set IMGFILEprefix "$DIRout/${userID}_temp" ##+#################################### ## Set the initial color-button colors. ##+#################################### set COLORLINEr 255 set COLORLINEg 0 set COLORLINEb 0 set COLORLINEhex [format "#%02X%02X%02X" $COLORLINEr $COLORLINEg $COLORLINEb ] update_color_button "line" set COLORAXISr 0 set COLORAXISg 0 set COLORAXISb 0 set COLORAXIShex [format "#%02X%02X%02X" $COLORAXISr $COLORAXISg $COLORAXISb ] update_color_button "axis" set COLORBKGDr 255 set COLORBKGDg 255 set COLORBKGDb 255 set COLORBKGDhex [format "#%02X%02X%02X" $COLORBKGDr $COLORBKGDg $COLORBKGDb ] update_color_button "bkgd" ##+################################################### ## Set the initial settings for various 'plotopts'. ##+################################################### set lineWIDTH 1 # set lineWIDTH 2 set Grid_0or1 0 set Border_0or1 1 ##+################################################### ## Set the initial settings for various 'tics' opts. ##+################################################### set XTICLABELangle "0" # set XTICLABELangle "-45" set YTICLABELangle "0" # set YTICLABELangle "10" set MinorTics_0or1 0 ##+################################################### ## Set the initial settings for various radiobuttons ## and fields at the bottom of the GUI. ##+################################################### # set RADVARlogscale "X" set RADVARlogscale "Y" # set RADVARlogscale "XY" set RADVARoutimg "gif" # set RADVARoutimg "png" # set RADVARoutimg "jpg" # set RADVARoutimg "ps" # set RADVARoutimg "psbw" # set RADVARoutimg "svg" # set RADVARoutimg "wxt" # set Xpixels "800" # set Ypixels "600" # set Xpixels "640" # set Ypixels "480" set Xpixels "600" set Ypixels "400" # set Xpixels "320" # set Ypixels "240" set RADVARplottype "lines" # set RADVARplottype "points" # set RADVARplottype "linespoints" .fRmsg.labelMSG configure -text \ "Click on 'RePlot' to get a plot with the current parameter settings." ## "Messages may appear here." ##+################################################## ## Set the image viewers for various image file types. ##+################################################## # set GIFviewer "firefox" # set GIFviewer "seamonkey" # set GIFviewer "/usr/bin/display" # set GIFviewer "/usr/bin/eom" set GIFviewer "/usr/bin/eog" # set PNGviewer "firefox" # set PNGviewer "seamonkey" # set PNGviewer "/usr/bin/display" # set PNGviewer "/usr/bin/eom" set PNGviewer "/usr/bin/eog" # set JPGviewer "firefox" # set JPGviewer "seamonkey" # set JPGviewer "/usr/bin/display" # set JPGviewer "/usr/bin/eom" set JPGviewer "/usr/bin/eog" # set PSviewer "/usr/bin/xpdf" set PSviewer "/usr/bin/evince" # set SVGviewer "firefox" # set SVGviewer "seamonkey" set SVGviewer "/usr/bin/inkscape" ##+################################################## ## Set text file viewer. ##+################################################## # set TXTFILEviewer "/usr/bin/kedit" # set TXTFILEviewer "/usr/bin/gedit" # set TXTFILEviewer "../../TextTools/tkXpg/xpg" # set TXTFILEviewer "../../shofil.tk" set TXTFILEviewer "$env(HOME)/apps/feXpg/scripts/xpg" ##+########################################### ## Set sample entry field values for testing ## --- and for final release. ##+########################################## set Xmin "*" set Xmax "*" set Y1min "*" set Y1max "*" set Y2min "*" set Y2max "*" set Y1linetype "1" set Y2linetype "2" if {0} { set DATAfilename "" set Xcolnum "1" set Y1colnum "2" set Y2colnum "" set PlotTITLE " PLOT TITLE goes here." set XaxisTITLE " X-axis TITLE goes here." set Y1axisTITLE " Y1-axis TITLE goes here." set Y2axisTITLE " Y2-axis TITLE goes here." } if {1} { set DATAfilename "$DIRthisScript/gnuplot_DATA_world_population.txt" set Xcolnum "1" set Y1colnum "2" set Y2colnum "" set PlotTITLE " World Population (year 1 to 2000)" set XaxisTITLE " Year" set Y1axisTITLE " World Population (millions)" set Y2axisTITLE "" } if {0} { set DATAfilename "$DIRthisScript/gnuplot_DATA_two_stock_prices.txt" set Xcolnum "1" set Y1colnum "2" set Y2colnum "3" set PlotTITLE " Average Prices of stocks PQR and XYZ, per year" set XaxisTITLE " Year" set Y1axisTITLE " Stock Price (dollars per share)" set Y2axisTITLE "" } if {0} { set DATAfilename "$DIRthisScript/gnuplot_DATA_XlabelsCol_test.txt" set Xcolnum "1" set Y1colnum "3" set XTICcolnum "2" set Y2colnum "" set PlotTITLE " X-tic-Labels-in-Data-Column Plot Test" set XaxisTITLE " Months in 2014 and 2015" set Y1axisTITLE " Blorts (millions)" set Y2axisTITLE "" } if {0} { set DATAfilename "$DIRthisScript/gnuplot_DATA_4cols_test.txt" set Xcolnum "1" set Y1colnum "2" set Y2colnum "3" set PlotTITLE " Four-columns-of-data Plot Test" set XaxisTITLE " Year" set Y1axisTITLE " Wheat & Barley (megablorts)" set Y2axisTITLE "" } ## Put the end of the filename in view. .fRfile.ent xview end ##+######################################################## ## Set the 'HELPtext' var. ## (Some of the variables set above are used in this text.) ##+######################################################## set HELPtext "\ \ \ ** HELP for this tkGUI FrontEnd for 'gnuplot' - to do LOG or LOG-LOG X-Y plots of 2-or-3 data columns from a user-selected data file ** This Tk script is meant to be a 'quick' xy-axis LOG-plot-from-file utility --- using 'gnuplot' to read data from a file, and allowing the user to easily select 2 or 3 columns of data to plot --- a column for the x-axis data and one or two columns for the y-axis data. This utility is oriented toward plots of many (tens or hundreds of) data points -- via connecting lines rather than data point markers. But data point markers can be an option --- instead of (or in addition to) the lines connecting data points. ####### The GUI: This Tk script presents a GUI to prompt for a data-file name and to specify which column of data to use for the x-axis and which column of data to use for y1 data --- with an option to specify a 3rd column for y2 data. Note that your data file could contain a hundred columns of data, and you could pick any 2 or 3 columns of data to plot. The GUI also provides entry fields for specifying - a title for the plot, - x-axis and y-axis titles, - x and y axis limits (min and max) - output image size, in pixels (x and y). If you leave the min,max entry fields defaulted to asterisk (*), 'gnuplot' will automatically determine axis limits and tic mark spacings. I may add entry fields for - x and y axis tic-mark intervals (someday?). In the meantime, 'gnuplot' will determine the tic-mark spacing, even if you specify min,max limits for the axes, rather than letting 'gnuplot' determine min,max limits. If the tic marks look 'funky', you can experiment with the min,max values to get more pleasant tic marks. The GUI also provides 3 radiobuttons for specifying whether to plot with - lines, points, or both. The GUI provides 5 radiobuttons for specifying - output image file type (GIF, PNG, JPG, PS, or SVG). A 'TestImg' button runs 'gnuplot' in a 'test' mode that displays example line-types and other plot options available with each of these output ('terminal') types. The GUI has 3 buttons to allow you to provide colors for the plot --- in particular, colors for the lines, and a color for the plot background. The line color is defaulted to red and the background is defaulted to white. Clicking on a color button brings up an RGB color selector Tk GUI to allow for quickly seeing and specifying a color with 3 RGB 'sliders'. ########################## TYPICAL OPERATIONAL STEPS: After specifying/selecting the data file and specifying the colums of data to use, if the user takes the defaults for the other options on the GUI, the user can click on the 'RePlot' button to cause the plot to be rendered and displayed. The user can then change the plot title, xy axis-labels, xy axis min-max, (xy tic-mark intervals, someday?) --- and click the 'RePlot' button again. The GUI has a 'LineType(1-29)' entry field, for both the Y1 and Y2 axes, by which you can choose from 29 different 'gnuplot' line types. You can see the types with the 'TestImg' button. The GUI also has an 'XticLabelsCol#' entry field in which you can specify a column of the file from which to fetch labels for X data values. Furthermore, the user can change the data filename and/or the column numbers, and click the 'RePlot' button again. Note that once you have selected a data file, you can repeatedly edit the file and click 'RePlot' after each edit to see the effects of your editing. For example, in doing testing of various options of this utility, this feature is handy when trying varying numbers of data points or various values of data or various X-tic labels in a plot. You can comment out various data lines or change various lines and quickly 'RePlot'. ####### OUTPUT: An output image file is displayed --- by an image-display program that is specified at the bottom of this Tk Script via variables named GIFviewer, PNGviewer, JPGviewer, PSviewer, and SVGviewer. The current settings are: GIFviewer: $GIFviewer PNGviewer: $PNGviewer JPGviewer: $JPGviewer PSviewer: $PSviewer SVGviewer: $SVGviewer For example, on Linux, the 'Eye of Gnome' (or 'Eye of MATE') viewer program can be used for GIF, PNG, and JPG files. The image file is put in a directory specified at the bottom of this Tk script. The file will be created with the suffix '.gif' or '.png' or '.jpg' or '.ps' or '.svg'. The prefix of the image filename is set at the bottom of the script in the variable 'IMGFILEprefix' --- which is currently set to $IMGFILEprefix The 'gnuplot' script is also put in a file specified at the bottom of this script via the variable 'OUTscript' --- which is currently set to $OUTscript You can edit this Tk script and change the output directory (DIRout) for the image and script files --- and change the middle-names of these files if you wish. (The userid is currently used in these 2 filenames to avoid overwriting someone else's output if you are working in a shared computing environment.) You can, of course, move these files to another directory if you want to save them. ################# ENHANCED PLOTTING with the 'gnuplot' script: This Tk GUI is not intended to try to allow for using the hundreds of command options of the 'gnuplot' program. However, if you find that a plot is almost what you want, and you could get what you want by using a few more commands or parameters of 'gnuplot', then you can edit the 'gnuplot' script --- $OUTscript --- to make changes to the script and execute it again. In fact, if your plot does not popup soon after clicking on the 'RePlot' button, the script may have failed due to a syntax error. In that case, you can go to the directory containing the script and execute it to look for error messages from the script. Then you can edit the script, try to fix the error, and execute it again. ############ DASHED LINES: Unfortunately, it appears that 'gnuplot' 4.2 and thereabout can give dashed lines (for linetypes 1 through 29) in Postscript output, but NOT with GIF, PNG, and JPEG output types. For linetypes 1 through 29, 'gnuplot' gives different colored SOLID lines in GIF, PNG, and JPEG output. This is rather unfortunate when you try to make plots for the color-challenged. (About 10 to 15% of the population is color-blind to some extent.) It appears that if you want dashed plot lines, you may have to use Postscript output. An alternative is to do lines-and-points plots, and use the different point styles to help the color-challenged identify the different plot lines. ################################### ADDITIONAL IMAGE PROCESSING OPTIONS: You can take an image capture of the Tk GUI --- with or without an output plot image beside it. For example, on Linux, a screen capture tool such as the 'gnome-screenshot' or 'mate-screenshot' program can be used. If necessary, an image editor (like 'mtpaint' on Linux) can be used to crop the window capture image. The image could also be down-sized --- say to make a smaller image suitable for use in a web page or an email. Furthermore, if you want dashed-line plots in a GIF or PNG or JPEG file, you could do a screen capture of a Postscript output --- getting a GIF, PNG, or JPEG file. Then edit that file (crop or resize it) with an image editor. Speaking of using an image editor: I put a time-stamp in the lower-left of the plots. An image editor can be used to crop that time-stamp off of the image or paint over it with the background color of the plot. ################## INPUT DATA SAMPLES: Some sources of sample input data may be found at - http://lib.stat.cmu.edu - the Data and Story Library (DASL) at StatLib of Carnegie-Mellon University - http://exploring-data.cqu.edu.au - The Exploring Data site at Central Queensland University - http://www.ics.usi.edu/~mlearn/MLRepository.html - the Machine Learning Repository at UnivOfCalifornia Irvine - http://www-personal.buseco.monash.edu.au/~hyndman/TSDL - R. J. Hyndman's Time Series Data Library These sources are seen in the 'Acknowledgments' section of the book 'Gnuplot in Action', by Philipp Janert, 2010. If some of these pages go dead (particularly the ~mlearn and ~hyndman pages), you can try web searches on keywords such as 'data library repository time series'. --- There are several sample datasets with names like - gnuplot_DATA_4cols_test.txt - gnuplot_DATA_XlabelsCol_test.txt - gnuplot_DATA_two_stock_prices.txt - gnuplot_DATA_world_population.txt in the directory with this Tk script, namely the directory $DIRthisScript #################### OTHER TYPES OF PLOTS: Some other types of plots (such as bar charts and math expression plots) are to be implemented by this author, with somewhat different Tk GUI interfaces. (Gnuplot calls bar charts 'histogram' plots.) ############################ ENHANCEMENTS OF THIS UTILITY: This utility currently allows for plotting Y1 and Y2 data on the same scale with just one Y-axis and with one Y-axis label --- on the left side of the plot. In the future, a grayed-out check button at the top of the GUI --- labeled 'Same Axis Units for Y1 and Y2' --- may be implemented. This would be intended to allow for placing a separate Y2-axis on the right side of the plot --- with its own axis label and its own scaling (min,max,tic-marks). Someday? --- Furthermore, I may try to get more appealing plots --- with color gradient backgrounds and with 'shadow curves' and with 'ribbon curves' --- by using some of the 'gnuplot tricks' of Zoltan Voros at http://www.phyast.pitt.edu/~zov1/gnuplot/html/gradient.html and http://www.phyast.pitt.edu/~zov1/gnuplot/html/shadowcurve.html and http://www.phyast.pitt.edu/~zov1/gnuplot/html/ribbon.html "