def __init__(
        self,
        selfExternal,
        parent,
        keepPreviousPlot,
        xwin,
        ywin,
        colorbg,
        xxDataLists,
        yyDataLists,
        numberOfTableCurves,
        numberOfBufferCurves,
        numberPylabPlotFigure,
# **kwargs 
        showTitle,
        showYLabel,
        showXLabel,
        showLegend,
        showLegendShadow,
        showGrid,
        showReferenceCurve,
        showSlopedStraightLineReferenceCurve,
        showHorizontalStraightLineReferenceCurve,
        showVerticalStraightLineReferenceCurve,
        colorBackground,
        colorXYLabels,
        colorXTicks,
        colorYTicks,
        colorTitle,
        colorPlotBorder,
        fontsizeTitle,
        fontsizeXYLabels,
        fontsizeXTicks,
        fontsizeYTicks,
        fontsizeLegend,
        valueTitle,
        valueLabelY,
        valueLabelX,
        valueLegendLocation,
        valuesLegendLabels,
        valueRefCurveMultiplier,
        valueRefCurveLabel,
        valueSlopedStraightLineRefCurveLabel,
        valueHorizontalStraightLineRefCurveLabel,
        valueVerticalStraightLineRefCurveLabel,
        valuesRefCurvePlotYList,
        valuesRefCurvePlotXList,
        valuesSlopedStraightLineRefCurvePlotYList,
        valuesSlopedStraightLineRefCurvePlotXList,
        valuesHorizontalStraightLineRefCurvePlotYList,
        valuesHorizontalStraightLineRefCurvePlotXList,
        valuesVerticalStraightLineRefCurvePlotYList,
        valuesVerticalStraightLineRefCurvePlotXList,
        plotStyle,
        plotBaseX,
        plotBaseY,
        lineWidthCurveFit,
        numPointsForCurveFit,
        markerSize,
        connectDataPoints,
        polyDegree,
        plotPolyDegree,
        plotAllLesserDegrees,
        numberDecimalPlacesInEqn,  # 0 for integers; otherwise, range is 1 to 10, editable
        formatPolyCoefs,
        ):
        
        selfExternal.MySQL_Output(
            1,
            '\n** In class ScatterPlot in module_PylabPlotMySQL_ScatterPlot'
            )
        
        if DEBUG:
            print('\nHorizontal xlist:')
            print(valuesHorizontalStraightLineRefCurvePlotXList)
            print('\nHorizontal ylist:')
            print(valuesHorizontalStraightLineRefCurvePlotYList)

# reset defaults
        pylab.rcdefaults()
        
# tell pylab which figue we are dealing with; otherwise, defaults to Figure 1, which conflicts with regular x-y plots        
        pylab.figure(
            numberPylabPlotFigure,
            facecolor=colorPlotBorder
            )
# color plot border
#        pylab.figure().patch.set_facecolor(colorPlotBorder)
            
# clear the figure
        if not keepPreviousPlot:
            pylab.clf()

# set plot background color            
        matplotlib.rc('axes', facecolor = colorBackground)
        matplotlib.rc('axes', labelsize = int(fontsizeXYLabels))
        matplotlib.rc('axes', labelcolor = colorXYLabels)
        matplotlib.rc('xtick', labelsize = int(fontsizeXTicks))
        matplotlib.rc('xtick', color = colorXTicks)
        matplotlib.rc('ytick', labelsize = int(fontsizeYTicks))
        matplotlib.rc('ytick', color = colorYTicks)
        
# scatter plot plotting options (4 colors, 4 line styles, and 7 markers = 112 unique plot possibilities);
#  however, since line styles are not used with scatterplots, there are 28 unique plot possibilities
# ... colors: b = blue, g = green, k = black, m = magenta
# ... NOTE: Don't use red here; red is used for polynomial curve fits
        plotOptions_Colors = ['b','g','k','m',]
        
#  ... line style: '-' solid line, '--' dashed line, ':' dotted line, '-.' dash-dot line
# ...  NOTE: these are not used for data plotted with scatterplots!
        plotOptions_LineStyles = ['-','--',':','-.']
        plotOptions_LineStyles = ['--']
        
# ... markers: s = square, o = filled circle, d = diamond, v = down triangle,
#                 ^ = up triangle, < = triangle left, > triangle right
        plotOptions_Markers = ['s','o','d','v','^','<','>']
        
# curve fit plotting options
# ... colors: r = red
        curveFitOptions_Colors = ['r']

# ... line style: '-' solid line, '--' dashed line, ':' dotted line, '-.' dash-dot line
        curveFitOptions_LineStyles = ['-','--',':','-.']
        
# markers: s = square, o = filled circle, d = diamond, v = down triangle,
#             ^ = up triangle, < = triangle left, > triangle right
# NOTE: do not use markers for curve fits, just use solid lines, dashed lines, etc.
        curveFitOptions_Markers = ['s','o','d','v','^','<','>']
        
# form list of plot options for data
        plotOptions = []
        if connectDataPoints:
            for style in plotOptions_LineStyles:
                for color in plotOptions_Colors:
                    for marker in plotOptions_Markers:
                        plotOptions.append(color + style + marker)
        else:
            for color in plotOptions_Colors:
                for marker in plotOptions_Markers:
                    plotOptions.append(color + marker)
# determine total number of options, so that when plotting, we can cycle thru the option using modulo function
        plotOptions_Total = len(plotOptions)
                    
# form list of plot options for curve fit
        curveFitOptions = []
        for style in curveFitOptions_LineStyles:
            for color in curveFitOptions_Colors:
#            for marker in curveFitOptions_Markers:
                curveFitOptions.append(color + style)
 #                   curveFitOptions.append(color + style + marker)
 # determine total number of options so that when plotting we can cycle thru the option using modulo funtion
        curveFitOptions_Total = len(curveFitOptions)

        if DEBUG:
            print('plotOptions = \n%s\n' % plotOptions)   
            print('curveFitOptions = \n%s\n' % curveFitOptions)
                       
# create plots
# ... only one plot
        subplot=111
        self.pylabSubplot = pylab.subplot(subplot)
        
        if DEBUG:
            print('\nxxDataLists from calling program:')
            print(xxDataLists)
            print('\nyyDataLists from calling program:')
            print(yyDataLists)
            print('')
            
# keep track of global values for xMin, yMin, xMax, yMax
        self.xMin_Global = []
        self.xMax_Global = []
        self.yMin_Global = []
        self.yMax_Global = []
    
# plot data; each list of data is plotted with separate markers
        for numberPlot in range(len(yyDataLists)):
# plot based on plotStyle
            plotOptionsIndex = numberPlot%plotOptions_Total
            
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                xxDataLists[numberPlot],
                yyDataLists[numberPlot],
                plotOptions[plotOptionsIndex],
                lineWidthCurveFit,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                xxDataLists[numberPlot], 
                yyDataLists[numberPlot]
                )
            
# compute 1-D vectors for both x and y by joining all data together
# ... used for determining polynomial coefficients by calling pylab.polyfit()
        x = []
        y = []
        for i in range(len(xxDataLists)):
            x.extend(xxDataLists[i])
            y.extend(yyDataLists[i])
            
#        print('\n x scatter = %s' % x)
#        print('\n y scatter = %s' % y)
            
# find min and max values for both x and y
        xmax = max(x)
        xmin = min(x)
        
# ... 'bestX' values for later determining 'bestY'
        deltaX = (xmax - xmin)/float(numPointsForCurveFit)
        bestX = []
        for i in range(numPointsForCurveFit + 1):
            if i == 0:
                xtemp = xmin
            else:
                xtemp += deltaX
            bestX.append(xtemp)
            
        if DEBUG:
            print('\nx = %s\n' % x)
            print('\ny = %s\n' % y)
            print('\nlen(x) = %s\n' % len(x))
            print('\nlen(y) = %s\n' % len(y))
            print('\nxmin = %s\n' % xmin)
            print('\nxmax = %s\n' % xmax)
            print('\nbestX = %s\n' % bestX)

# determine bestY best fit for bestX; 
# ... also, string for polynomial equation to be listed in legend
        bestY, stringEqn, stringEqnForLegend = \
                self.dataFit(x,y,bestX,polyDegree,numberDecimalPlacesInEqn,formatPolyCoefs)  
                
# ... parameters stored for use in calling program to place in storage buffer
# ...    initialization
        selfExternal.curvefit_CurveFitEquations_Scatter = []
        selfExternal.curvefit_BestY_Scatter = []
        selfExternal.curvefit_YHeader_Scatter = []
# ...    define values for main curve fit equation
        selfExternal.curvefit_CurveFitEquations_Scatter.append(stringEqnForLegend.lstrip())
        selfExternal.curvefit_BestY_Scatter.append(bestY)
        selfExternal.curvefit_BestX_Scatter = bestX
#        selfExternal.curvefit_YHeader_Scatter.append(valueLabelY)
        selfExternal.curvefit_YHeader_Scatter.append(stringEqnForLegend.lstrip())
        selfExternal.curvefit_XHeader_Scatter = valueLabelX
        selfExternal.curvefit_Title_Scatter = valueTitle

        if DEBUG:
            print('\ncurveFitOptions = \n')
            print(curveFitOptions)
            print()
            
# plot polynomial curve fit
        if plotPolyDegree:
        
            valuesLegendLabels.append(stringEqnForLegend)
            
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                bestX,
                bestY,
                curveFitOptions[0],
                lineWidthCurveFit,
                markerSize,
                plotBaseX,
                plotBaseY,
                )

            module_PlotUtilities.globalMinMaxValues(self,bestX,bestY)
                
# fit all lesser degrees
            if (plotAllLesserDegrees) and (polyDegree > 1):
                optionsIndex = 0
                for i in range(polyDegree - 1,0,-1):
                    bestY, stringEqn, stringEqnForLegend = \
                            self.dataFit(x,y,bestX,i,numberDecimalPlacesInEqn,formatPolyCoefs)
                    if DEBUG:
                        print('For polynomial of degree %s: %s' % (i,stringEqn))
# ... store for use in calling program; strip leading white space
                    selfExternal.curvefit_CurveFitEquations_Scatter.append(stringEqnForLegend.lstrip())
                    selfExternal.curvefit_BestY_Scatter.append(bestY)
                    selfExternal.curvefit_YHeader_Scatter.append(stringEqnForLegend.lstrip())
# ... define options index
                    optionsIndex += 1
# ... cycle thru the values using the modulo operator
                    curveFitOptionsIndex = optionsIndex%curveFitOptions_Total
                    valuesLegendLabels.append(stringEqnForLegend)
                    
                    module_PlotUtilities.plotStyleForCurve(
                        self,
                        pylab,
                        plotStyle,
                        bestX,
                        bestY,
                        curveFitOptions[curveFitOptionsIndex],
                        lineWidthCurveFit,
                        markerSize,
                        plotBaseX,
                        plotBaseY,
                        )
                        
                    module_PlotUtilities.globalMinMaxValues(self,bestX,bestY)                    
                    
# reference plot, if desired
        if showReferenceCurve:
            valuesLegendLabels.append(
                str(valueRefCurveMultiplier) + ' * (' + valueRefCurveLabel +
                ') [ref]'
                )
            stringInvalidMultiplier = (
                'Unable to plot reference curve:' + '\n'
                '  Invalid value for reference curve multiplier.\n' +
                '  Multiplier must be a string representing either\n' +
                '  an integer, float, or fraction (e.g., 1/5).\n' 
                )
# change multiplier to decimal
            tempMult = valueRefCurveMultiplier
            if tempMult == '1/10':
                multiplier = 1./10.
            elif tempMult == '1/9':
                multiplier = 1./9.
            elif tempMult == '1/8':
                multiplier = 1./8.
            elif tempMult == '1/7':
                multiplier = 1./7.
            elif tempMult == '1/6':
                multiplier = 1./6.
            elif tempMult == '1/5':
                multiplier = 1./5.
            elif tempMult == '1/4':
                multiplier = 1./4.
            elif tempMult == '1/3':
                multiplier = 1./3.
            elif tempMult == '1/2':
                multiplier = 1./2.
            elif tempMult == '2':
                multiplier = 2.
            elif tempMult == '3':
                multiplier = 3.
            elif tempMult == '4':
                multiplier = 4.
            elif tempMult == '5':
                multiplier = 5.
            elif tempMult == '6':
                multiplier = 6.
            elif tempMult == '7':
                multiplier = 7.
            elif tempMult == '8':
                multiplier = 8.
            elif tempMult == '9':
                multiplier = 9.
            elif tempMult == '10':
                multiplier = 10.
            elif tempMult.count('/') == 1:
# just one division sign is present in string, so try arbitrary fraction; if fails, nothing left to try
                tempMult_New = tempMult.split('/')
                try:
                    multiplier = float(tempMult_New[0]) / float(tempMult_New[1])
                except:
                # form error string
                    selfExt.MySQL_Output(
                        1,
                        stringInvalidMultiplier
                        )
                    showinfo(
                        'Error: invalid value',
                        '\n' + stringInvalidMultiplier + '\n'
                        )
                    return               
            else:
# last ditch chance to just float the string representing a number; if fails, nothing left to try
                try:
                    multiplier = float(valueRefCurveMultiplier)
                except:                   
                    selfExt.MySQL_Output(
                        1,
                        stringInvalidMultiplier
                        )
                    showinfo(
                        'Error: invalid value',
                        '\n' + stringInvalidMultiplier + '\n'
                        )
                    return
                    
# choose correct X-values for reference curve
# ... plot X and Y lists
            plot_X_RefCurve = valuesRefCurvePlotXList           
            plot_Y_RefCurve = [float(y)*float(multiplier) for y in valuesRefCurvePlotYList]

# ... set up plots   
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                plot_X_RefCurve,
                plot_Y_RefCurve,
                'r--d',
                lineWidthCurveFit,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                plot_X_RefCurve,
                plot_Y_RefCurve
                )
                
# sloped straight-line reference curve, if desired
        if showSlopedStraightLineReferenceCurve:
            valuesLegendLabels.append(
                valueSlopedStraightLineRefCurveLabel
                )
                
# ... no need to error check; validation done in "SCATTER PLOT SPECS" window     
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                valuesSlopedStraightLineRefCurvePlotXList,
                valuesSlopedStraightLineRefCurvePlotYList,
                'r--s',
                lineWidthCurveFit,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                valuesSlopedStraightLineRefCurvePlotXList,
                valuesSlopedStraightLineRefCurvePlotYList
                )

# horizontal straight-line reference curve, if desired
        if showHorizontalStraightLineReferenceCurve:
            valuesLegendLabels.append(
                valueHorizontalStraightLineRefCurveLabel
                )
                
# ... no need to error check; validation done in "SCATTER PLOT SPECS" window   
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                valuesHorizontalStraightLineRefCurvePlotXList,
                valuesHorizontalStraightLineRefCurvePlotYList,
                'r--s',
                lineWidthCurveFit,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                valuesHorizontalStraightLineRefCurvePlotXList,
                valuesHorizontalStraightLineRefCurvePlotYList
                )
            
# vertical straight-line reference curve, if desired
        if showVerticalStraightLineReferenceCurve:
            valuesLegendLabels.append(
                valueVerticalStraightLineRefCurveLabel
                )

# ... no need to error check; validation done in "SCATTER PLOT SPECS" window  
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                valuesVerticalStraightLineRefCurvePlotXList,
                valuesVerticalStraightLineRefCurvePlotYList,
                'r--s',
                lineWidthCurveFit,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                valuesVerticalStraightLineRefCurvePlotXList,
                valuesVerticalStraightLineRefCurvePlotYList
                ) 

# display legend
        if showLegend:
            if DEBUG:
                print '\n====\nvaluesLegendLabels:\n',valuesLegendLabels
                
# legend labels
            stringLegendLabels = []
#            lenLabels = len(self.plot_Labels)
            lenLabels = len(valuesLegendLabels)
#            for label in self.plot_Labels:
            for label in valuesLegendLabels:
                stringLegendLabels.append(label)
                    
# title (fontsize specified in rcparams)
        if showTitle:
            pylab.title(
                valueTitle, 
                color=colorTitle,
                size=fontsizeTitle,
                )

# y label (fontsize specified in rcparams)
        if showYLabel:
            pylab.ylabel(
                valueLabelY,
                color=colorXYLabels,
                size=fontsizeXYLabels,
                )
 
# x label (fontsize specified in rcparams)
        if showXLabel:
            pylab.xlabel(
                valueLabelX,
                color=colorXYLabels,
                size=fontsizeXYLabels,
                )

# legend
        if showLegend:
            pylab.legend(
                stringLegendLabels,
                prop={'size':fontsizeLegend},
                loc=valueLegendLocation,
                shadow=showLegendShadow,
                )
                
# if any plots have base 'e', form new labels; 
# ... pass in all min-max data
        if DEBUG:
            print('\nself.xMin_Global:')
            print(self.xMin_Global)
            print('\nself.xMax_Global:')
            print(self.xMax_Global)
            print('\nself.yMin_Global:')
            print(self.yMin_Global)
            print('\nself.yMax_Global:')
            print(self.yMax_Global)
            print('')
            
        if plotStyle == 'semilogx' or plotStyle == 'loglog':
            if plotBaseX == 'e':
                xMin_Local = min(self.xMin_Global)
                xMax_Local = max(self.xMax_Global)
                okXLabels = module_PlotUtilities.formNewXLabels(
                    self,pylab,xMin_Local,xMax_Local,colorXTicks,fontsizeXTicks
                    )
                if not okXLabels:
                        return
            
        if plotStyle == 'semilogy' or plotStyle == 'loglog':
            if plotBaseY == 'e':
                yMin_Local = min(self.yMin_Global)
                yMax_Local = max(self.yMax_Global)
                okYLabels = module_PlotUtilities.formNewYLabels(
                    self,pylab,yMin_Local,yMax_Local,colorYTicks,fontsizeYTicks
                    )  
                if not okYLabels:
                        return
                        
# grid
        if showGrid:
            pylab.grid(showGrid)
        
# finally, plot it
        pylab.show()
     
        return
    def plot_OnePlotPerCurve(self,
        showMainTitle,
        showPlotTitles,
        showGrids,
        mainTitle,
        colorMainTitle,
        fontsizeMainTitle,
        fontsizePlotTitles,
        fontsizeXYLabels,
        colorXYLabels,
        fontsizeXTicks,
        colorXTicks,
        fontsizeYTicks,
        colorYTicks,
        colorChartBackground,
        colorPlotBorder,
        plotStyle,
        plotBaseX,
        plotBaseY,
        lineWidth,
        markerSize,
        ):
        '''
        Calls pylab.plot to do the actual plotting; data
        is specified.
        
        Max number of plots: 25
        
        Variables:
            self.plot_X[] (x list of length 1)
            self.plot_Y[] (y list of lists of variable length)
            
        Plot Options:
            self.plotOptions (list of third argument plot line
                                colors, line styles, line markers)
            plotOptions_SubPlot (number determining rows x columns x plot_number)
            
            
        Labels:
            x label:        self.varLabelX
            y label:        self.varLabelY[]
            plot title:     self.varPlotTitle
        '''

        if DEBUG:
            print('\n-- DEBUG --')
            print('showMainTitle: %s (%s)' % (showMainTitle, type(showMainTitle)))
            print('showPlotTitles: %s (%s)' % (showPlotTitles,type(showPlotTitles)))
            print('showGrids: %s (%s)' % (showGrids,type(showGrids)))
            print('mainTitle: %s (%s)' % (mainTitle,type(mainTitle)))
            print('fontsizeMainTitle: %s (%s)' % (fontsizeMainTitle,type(fontsizeMainTitle)))
            print('fontsizePlotTitles: %s (%s)' % (fontsizePlotTitles,type(fontsizePlotTitles)))
            print('fontsizeXYLabels: %s (%s)' % (fontsizeXYLabels,type(fontsizeXYLabels)))
            print('colorXYLabels: %s (%s)' % (colorXYLabels,type(colorXYLabels)))
            print('fontsizeXTicks: %s (%s)' % (fontsizeXTicks,type(fontsizeXTicks)))
            print('colorXTicks: %s (%s)' % (colorXTicks,type(colorXTicks)))
            print('fontsizeYTicks: %s (%s)' % (fontsizeYTicks,type(fontsizeYTicks)))
            print('colorYTicks: %s (%s)' % (colorYTicks,type(colorYTicks)))
            print('colorChartBackground: %s (%s)' % (colorChartBackground,type(colorChartBackground)))
            print('plotStyle: %s (%s)' % (plotStyle,type(plotStyle)))
            print('plotBaseX: %s (%s)' % (plotBaseX,type(plotBaseX)))
            print('plotBaseY: %s (%s)' % (plotBaseY,type(plotBaseY)))
            print('lineWidth: %s (%s)' % (lineWidth,type(lineWidth)))
            print('markerSize: %s (%s)' % (markerSize,type(markerSize)))
            print('-- END OF DEBUG --\n')
    
# destroy old popup
#        try:
#            self.frame_ToplevelPylabPlotMySQL.destroy()
#        except:
#            pass        
        
# determine dimension of subplot, upto 'numberCurvesMax' plots max
        lenYList = len(self.plot_Y)  # tells how many curves, and therefore how many plots, are to be drawn
# bounds check; no more than 'numberCurvesMax' plots in a 5x5 array allowed; 
        if lenYList > numberCurvesMax:
            stringLenYList = (
                'Number of plots out of range:\n\n' +
                '   Number of plots attempted: ' + str(lenYList) + '\n' +
                '   Max number of plots allowed: ' + str(numberCurvesMax) + '\n\n' +
                'To continue with plotting the first ' + str(numberCurvesMax) + '\n' +
                ' of ' + str(lenYList) + ' plots selected, click "OK".' + '\n\n' +
                'To halt plotting, click "CANCEL".' + '\n'
                )
            ans = askokcancel(
                'Max number of plots exceeded',
                stringLenYList
                )
            if not ans:
                return 
            else:
                lenYList = numberCurvesMax
         
        plotOptions_SubPlot = []
        if lenYList == 1: 
            plotOptions_SubPlot = [1,1,0]
        elif lenYList <= 2: 
            plotOptions_SubPlot = [2,1,0]
        elif lenYList <= 4:
            plotOptions_SubPlot = [2,2,0]
        elif lenYList <= 6:
            plotOptions_SubPlot = [3,2,0]
        elif lenYList <= 9:
            plotOptions_SubPlot = [3,3,0]
        elif lenYList <= 12:
            plotOptions_SubPlot = [4,3,0]
        elif lenYList <= 16:
            plotOptions_SubPlot = [4,4,0]
        elif lenYList <= 20:
            plotOptions_SubPlot = [5,4,0]
        elif lenYList <= 25:
            plotOptions_SubPlot = [5,5,0]
        else:
            stringLenYList = (
                'Number of plots out of range:\n' +
                '   Number of plots attempted: ' + str(lenYList) + '\n' +
                '   Max number of plots allowed: ' + str(lenYList_Max) + '\n\n' +
                'Please choose 25 or less plots and try again.\n'
                )
            print stringLenYList
            self.MySQL_Output(
                1,
                stringLenYList
                )
            showinfo(
                'Error: too many plots',
                '\n' + stringLenYList + '\n'
                )
            return  
        
# reset defaults
        pylab.rcdefaults()

# tell pylab which figue we are dealing with; otherwise, defaults to Figure 1
        pylab.figure(
            self.numberPylabPlotFigure,
            facecolor=colorPlotBorder
            )
            
# color plot border
#        pylab.figure().patch.set_facecolor(colorPlotBorder)
        
# clear the figure
        if not self.keepPreviousPlot:         
            pylab.clf()

# set some plot params
        params = {
#                   'font.size' : int(fontsizePlotTitles), #fontsizeGeneral for title
              'axes.facecolor' : colorChartBackground,   #chart background color
              'axes.labelsize' : int(fontsizeXYLabels),   #fontsizeChartLabels,
             'axes.labelcolor' : colorXYLabels,  #chart x-y label colors
             'xtick.labelsize' : int(fontsizeXTicks),   #fontsizeXTickLabels,
                 'xtick.color' : colorXTicks,    #colorXTickLabels, 
             'ytick.labelsize' : int(fontsizeYTicks),  #fontsizeYTickLabels,
                 'ytick.color' : colorYTicks,  #colorYTickLabels,  
#             'lines.linewidth' : lineWidth, # width of data plot lines (0=thin, 5=thick)                 
            }
# update the params
        pylab.rcParams.update(params)
        
# create plots
# ... subplot base number, which determines plot layout in plot window
        numRowsTotal = plotOptions_SubPlot[0]
        numColumnsTotal = plotOptions_SubPlot[1]
        subplot = 0

# iterate over plots
        for numberPlot in range(lenYList):
        
# keep track of subplot number
            subplot+=1
            
# define subplot FIRST before defining other parameters
            self.pylabSubplot = pylab.subplot(numRowsTotal,numColumnsTotal,subplot)

# set plot sizes within frame; also set distance from each other vertically and horizontally
            pylab.subplots_adjust(
                left=0.125,
                right=0.9,
                bottom=0.1,
                top=0.9,
                wspace=0.30,
                hspace=0.5,
                )
            
            pylab.grid(showGrids)
            
# use following x and y label for multiplot labeling
# ... x label
            try:
                pylab.xlabel(self.label_X[numberPlot])
            except:
                stringErrorXLabel = (
                    'The value\n\n' +
                    '   self.label_X[numberPlot]\n\n' +
                    'is out of range in module_PylabPlotMySQL_Single.\n\n' + 
                    'This is a coding error. Please contact the\n' +
                    'code administrator.'
                    )
                print stringErrorXLabel
                showinfo(
                    'Error: out of range',
                    stringErrorXLabel
                    )
                return
# ... y label
            try:
                pylab.ylabel(self.label_Y[numberPlot])   
            except:
                stringErrorYLabel = (
                    'The value\n\n' +
                    '   self.label_Y[numberPlot]\n\n' +
                    'is out of range in module_PylabPlotMySQL_Single.\n\n' +
                    'This is a coding error. Please contact the\n' +
                    'code administrator.'
                    )
                print stringErrorYLabel
                showinfo(
                    'Error: out of range',
                    stringErrorYLabel
                    )
                return  
                
# ... use title for single plots only
#            pylab.title(self.varPlotTitle.get())
            if showPlotTitles:
                colorTitle = 'black'
                pylab.title(
                    self.label_Y[numberPlot],
                    color=colorTitle,
                    size=fontsizePlotTitles
                    )

            if DEBUG:
                print('self.plotOptions[0]: %s',self.plotOptions[0])
            
 #           self.plotStyleForCurve(
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                self.plot_X[numberPlot],
                self.plot_Y[numberPlot],
                self.plotOptions[0],
                lineWidth,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
# zero out global values for xMin, yMin, xMax, yMax for each plot
            self.xMin_Global = []
            self.xMax_Global = []
            self.yMin_Global = []
            self.yMax_Global = []
            
# determine min and max values for each plot
#            self.globalMinMaxValues(
            module_PlotUtilities.globalMinMaxValues(
                self,
                self.plot_X[numberPlot],
                self.plot_Y[numberPlot]
                )
                
# change labels to 'e' if needed
            if plotStyle == 'semilogx' or plotStyle == 'loglog':
                if plotBaseX == 'e':
                    xMin_Local = min(self.xMin_Global)
                    xMax_Local = max(self.xMax_Global)
#                    self.formNewXLabels(xMin_Local,xMax_Local,colorXTicks,fontsizeXTicks)
                    okXLabels = module_PlotUtilities.formNewXLabels(
                        self,pylab,xMin_Local,xMax_Local,colorXTicks,fontsizeXTicks
                        )
                    if not okXLabels:
                        return
            
            if plotStyle == 'semilogy' or plotStyle == 'loglog':
                if plotBaseY == 'e':
                    yMin_Local = min(self.yMin_Global)
                    yMax_Local = max(self.yMax_Global)
#                    self.formNewYLabels(yMin_Local,yMax_Local,colorYTicks,fontsizeYTicks) 
                    okYLabels = module_PlotUtilities.formNewYLabels(
                        self,pylab,yMin_Local,yMax_Local,colorYTicks,fontsizeYTicks
                        ) 
                    if not okYLabels:
                        return
        
# --- end of for loop ---

# show overall plot title
        if showMainTitle:
            pylab.suptitle(
                mainTitle,
                color=colorMainTitle,
                fontsize=fontsizeMainTitle
                )
                
# graph the plot
        pylab.show()
        
        return
    def plot_SeveralCurvesOnOnePlot(self,
        selfExt,
        showTitle,
        showYLabel,
        showXLabel,
        showLegend,
        showGrid,
        showReferenceCurve,
        showSlopedStraightLineReferenceCurve,
        showHorizontalStraightLineReferenceCurve,
        showVerticalStraightLineReferenceCurve,
        colorBackground,
        colorPlotBorder,
        colorXYLabels,
        colorXTicks,
        colorYTicks,
        colorTitle,
        fontsizeTitle,
        fontsizeXYLabels,
        fontsizeXTicks,
        fontsizeYTicks,
        fontsizeLegend,
        valueTitle,
        valueLabelY,
        valueLabelX,
        valueLegendLocation,
        valuesLegendLabels,
        valueRefCurveMultiplier,
        valueRefCurveLabel,
        valueSlopedStraightLineRefCurveLabel,
        valueHorizontalStraightLineRefCurveLabel,
        valueVerticalStraightLineRefCurveLabel,
        valuesRefCurvePlotYList,
        valuesRefCurvePlotXList,
        valuesSlopedStraightLineRefCurvePlotYList,
        valuesSlopedStraightLineRefCurvePlotXList,
        valuesHorizontalStraightLineRefCurvePlotYList,
        valuesHorizontalStraightLineRefCurvePlotXList,
        valuesVerticalStraightLineRefCurvePlotYList,
        valuesVerticalStraightLineRefCurvePlotXList,
        plotStyle,
        plotBaseX,
        plotBaseY,
        lineWidth,
        markerSize
        ):
        '''
        Calls pylab.plot to do the actual plotting; data
        is specified.
        
        These are NOT demo plots.
        
        Max number of plots: 25 + 1 reference curve
        
        Variables:
            self.plot_X[] (x list of length 1)
            self.plot_Y[] (y list of lists of variable length)
            
        Plot Options:
            self.plotOptions (list of third argument plot line
                                colors, line styles, line markers)
            plotOptions_SubPlot (number determining rows x columns x plot_number)
            
            
        Labels and such from handlerPlotPreprocess:
           plot title:
                button status   self.varCheckbuttonShowTitle_AllCurvesOnePlot.get()
                value           self.varShowTitle_AllCurvesOnePlot.get()
            y label:
                button status   self.varCheckbuttonShowLabelY_AllCurvesOnePlot.get()
                value           self.varShowLabelY_AllCurvesOnePlot.get()
            x label:
                button status   self.varCheckbuttonShowLabelX_AllCurvesOnePlot.get()
                value           self.varShowLabelX_AllCurvesOnePlot.get()
            show grid:
                button status   self.varCheckbuttonShowGrid_AllCurvesOnePlot.get()
            reference curve: 
                button status   self.varCheckbuttonShowReferenceCurve_AllCurvesOnePlot.get()
                scale           self.comboboxShowReferenceCurveMultiplier_AllCurvesOnePlot.get()
                curve           self.comboboxShowReferenceCurveLabeled_AllCurvesOnePlot.get()
        '''
        
        if DEBUG:
            print('\n-- DEBUG --')
            print('showTitle: %s (%s)' % (showTitle, type(showTitle)))
            print('showYLabel: %s (%s)' % (showYLabel,type(showYLabel)))
            print('showXLabel: %s (%s)' % (showXLabel,type(showXLabel)))
            print('showLegend: %s (%s)' % (showLegend,type(showLegend)))
            print('showGrid: %s (%s)' % (showGrid,type(showGrid)))
            print('showReferenceCurve: %s (%s)' % (showReferenceCurve,type(showReferenceCurve)))
            print('showSlopedStraightLineReferenceCurve: %s (%s)' % (
                showSlopedStraightLineReferenceCurve,
                type(showSlopedStraightLineReferenceCurve))
                )
            print('showHorizontalStraightLineReferenceCurve: %s (%s)' % (
                showHorizontalStraightLineReferenceCurve,
                type(showHorizontalStraightLineReferenceCurve))
                )
            print('showVerticalStraightLineReferenceCurve: %s (%s)' % (
                showVerticalStraightLineReferenceCurve,
                type(showVerticalStraightLineReferenceCurve))
                )
            print('colorBackground: %s (%s)' % (colorBackground,type(colorBackground)))
            print('colorXYLabels: %s (%s)' % (colorXYLabels,type(colorXYLabels)))
            print('colorXTicks: %s (%s)' % (colorXTicks,type(colorXTicks)))
            print('colorYTicks: %s (%s)' % (colorYTicks,type(colorYTicks)))
            print('colorTitle: %s (%s)' % (colorTitle,type(colorTitle)))
            print('fontsizeTitle: %s (%s)' % (fontsizeTitle,type(fontsizeTitle)))
            print('fontsizeXYLabels: %s (%s)' % (fontsizeXYLabels,type(fontsizeXYLabels)))
            print('fontsizeXTicks: %s (%s)' % (fontsizeXTicks,type(fontsizeXTicks)))
            print('fontsizeYTicks: %s (%s)' % (fontsizeYTicks,type(fontsizeYTicks)))
            print('fontsizeLegend: %s (%s)' % (fontsizeLegend,type(fontsizeLegend)))
            print('valueTitle: %s (%s)' % (valueTitle,type(valueTitle)))
            print('valueLabelY: %s (%s)' % (valueLabelY,type(valueLabelY)))
            print('valueLabelX: %s (%s)' % (valueLabelX,type(valueLabelX)))
            print('valueLegendLocation: %s (%s)' % (valueLegendLocation,type(valueLegendLocation)))
            print('valuesLegendLabels: %s (%s)' % (valuesLegendLabels,type(valuesLegendLabels)))
            print('valueRefCurveMultiplier: %s (%s)' % (valueRefCurveMultiplier,type(valueRefCurveMultiplier)))
            print('valueRefCurveLabel: %s (%s)' % (valueRefCurveLabel,type(valueRefCurveLabel)))
            print('valueSlopedStraightLineRefCurveLabel: %s (%s)' % (
                valueSlopedStraightLineRefCurveLabel,
                type(valueSlopedStraightLineRefCurveLabel))
                )
            print('valueHorizontalStraightLineRefCurveLabel: %s (%s)' % (
                valueHorizontalStraightLineRefCurveLabel,
                type(valueHorizontalStraightLineRefCurveLabel))
                )
            print('valueVerticalStraightLineRefCurveLabel: %s (%s)' % (
                valueVerticalStraightLineRefCurveLabel,
                type(valueVerticalStraightLineRefCurveLabel))
                )
            print('valuesRefCurvePlotYList: %s (%s)' % (
                valuesRefCurvePlotYList,
                type(valuesRefCurvePlotYList))
                )
            print('valuesRefCurvePlotXList: %s (%s)' % (
                valuesRefCurvePlotXList,
                type(valuesRefCurvePlotXList))
                )
            print('valuesSlopedStraightLineRefCurvePlotYList: %s (%s)' % (
                valuesSlopedStraightLineRefCurvePlotYList,
                type(valuesSlopedStraightLineRefCurvePlotYList))
                )
            print('valuesSlopedStraightLineRefCurvePlotXList: %s (%s)' % (
                valuesSlopedStraightLineRefCurvePlotXList,
                type(valuesSlopedStraightLineRefCurvePlotXList))
                )
            print('valuesHorizontalStraightLineRefCurvePlotYList: %s (%s)' % (
                valuesHorizontalStraightLineRefCurvePlotYList,
                type(valuesHorizontalStraightLineRefCurvePlotYList))
                )
            print('valuesHorizontalStraightLineRefCurvePlotXList: %s (%s)' % (
                valuesHorizontalStraightLineRefCurvePlotXList,
                type(valuesHorizontalStraightLineRefCurvePlotXList))
                )
            print('valuesVerticalStraightLineRefCurvePlotYList: %s (%s)' % (
                valuesVerticalStraightLineRefCurvePlotYList,
                type(valuesVerticalStraightLineRefCurvePlotYList))
                )
            print('valuesVerticalStraightLineRefCurvePlotXList: %s (%s)' % (
                valuesVerticalStraightLineRefCurvePlotXList,
                type(valuesVerticalStraightLineRefCurvePlotXList))
                )
            print('plotStyle: %s (%s)' % (plotStyle,type(plotStyle)))
            print('plotBaseX: %s (%s)' % (plotBaseX,type(plotBaseX)))
            print('plotBaseY: %s (%s)' % (plotBaseY,type(plotBaseY)))
            print('lineWidth: %s (%s)' % (lineWidth,type(lineWidth)))
            print('markerSize: %s (%s)' % (markerSize,type(markerSize)))
            print('-- END OF DEBUG --\n')
    
# destroy old popup
#        try:
#            self.frame_ToplevelPylabPlotMySQL.destroy()
#        except:
#            pass

# determine dimension of subplot, upto 'numberCurvesMax' plots max
        lenYList = len(self.plot_Y)  # tells how many curves, and therefore how many plots, are to be drawn
# bounds check; no more than 'numberCurvesMax' plots in a 5x5 array allowed; 
        if lenYList > numberCurvesMax:
            stringLenYList = (
                'Number of curves to plot is out of range:\n\n' +
                '   Number of curves attempted: ' + str(lenYList) + '\n' +
                '   Max number of curves allowed: ' + str(numberCurvesMax) + '\n\n' +
                'To continue with plotting the first ' + str(numberCurvesMax) + '\n' +
                ' of ' + str(lenYList) + ' curves selected, click "OK".' + '\n\n' +
                'To halt plotting, click "CANCEL".' + '\n'
                )
            ans = askokcancel(
                'Max number of curves exceeded',
                stringLenYList
                )
            if not ans:
                return 
            else:
                lenYList = numberCurvesMax
   
# print figure number:
        if DEBUG:
            print(
                '\n------------------\n' + 
                'In module_PylabPlotMySQL_All\n' +
                '    self.numberPylabPlotFigure = %s' 
                ) % self.numberPylabPlotFigure
                
        
# reset defaults
        pylab.rcdefaults()
        
# tell pylab which figue we are dealing with; otherwise, defaults to Figure 1, which conflicts with regular x-y plots        
        pylab.figure(
            self.numberPylabPlotFigure,
            facecolor=colorPlotBorder
            )
            
# color plot border
#        pylab.figure().patch.set_facecolor(colorPlotBorder)
            
# clear the figure
        if not self.keepPreviousPlot:
            pylab.clf()
       
# set some plot params
        params = {
              'axes.facecolor' : colorBackground,   #colorChartBackground, # plot bg USE THIS!
              'axes.labelsize' : int(fontsizeXYLabels),   #fontsizeChartLabels,
             'axes.labelcolor' : colorXYLabels,  #colorChartLabels,    # x-y labels
             'xtick.labelsize' : int(fontsizeXTicks),   #fontsizeXTickLabels,
                 'xtick.color' : colorXTicks,    #colorXTickLabels, 
             'ytick.labelsize' : int(fontsizeYTicks),  #fontsizeYTickLabels,
                 'ytick.color' : colorYTicks,  #colorYTickLabels,
             'legend.fontsize' : int(fontsizeLegend),
#             'lines.linewidth' : lineWidth, # width of data plot lines and legend labels (0=thin, 5=thick)
#                 'figure.titlesize': 24,
#                 'figure.facecolor' : 'darkgray',
#                 'figure.edgecolor' : 'cyan',
#                 'figure.figsize' : [float(widthChartFigure), float(heightChartFigure)],
#                 'axes.titlesize' :  8,   #fontsizeChartTitle,
            }
            
# update the params   
        pylab.rcParams.update(params)
        
# create plots
# ... only one plot; all curves on one plot
        subplot=111
        
# ... define subplot FIRST before defining other parameters
        self.pylabSubplot = pylab.subplot(subplot)

# ... apply grid 
        pylab.grid(showGrid)
# ... x and y labels
        if showXLabel:
            pylab.xlabel(valueLabelX)
        if showYLabel:
            pylab.ylabel(valueLabelY)
# ... plot title
        if showTitle:
            pylab.title(
                valueTitle,
                color=colorTitle,
                size=fontsizeTitle
                )
            
        if DEBUG:
            print(
                '\nmodule_PylabPlotMySQL_All self.plot_X = '
                )
            print(self.plot_X)
            print(
                '\nmodule_PylabPlotMySQL_All self.plot_Y = '
                )
            print(self.plot_Y)
            
            if lenYList > numberCurvesMax:
                stringErrorNumberPlot = (
                    'Number of curves requested for plotting is over\n' +
                    'the maximum:\n\n' +
                    '  number of curves requested: %s\n' +
                    '  number of curves allowed: %s\n\n' +
                    'Reduce the number of curves to be plotted and try again.'
                    ) % (
                    lenYList,
                    numberCurvesMax
                    )
                print stringErrorNumberPlot
                showinfo(
                    'Error: too many curves',
                    stringErrorNumberPlot
                    )
                return      
            
# keep track of global values for xMin, yMin, xMax, yMax
        self.xMin_Global = []
        self.xMax_Global = []
        self.yMin_Global = []
        self.yMax_Global = []
        
# ... plot x-y
        for numberPlot in range(lenYList):
        
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                self.plot_X[numberPlot],
                self.plot_Y[numberPlot],
                self.plotOptions[numberPlot],
                lineWidth,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,self.plot_X[numberPlot], self.plot_Y[numberPlot]
                )
      
# reference plot, if desired
        if showReferenceCurve:
            stringInvalidMultiplier = (
                'Unable to plot reference curve:' + '\n'
                '  Invalid value for reference curve multiplier.\n' +
                '  Multiplier must be a string representing either\n' +
                '  an integer, float, or fraction (e.g., 1/5).\n' 
                )
# change multiplier to decimal
            tempMult = valueRefCurveMultiplier
#            print 'tempMult, type = ',tempMult,type(tempMult)
            if tempMult == '1/10':
                multiplier = 1./10.
            elif tempMult == '1/9':
                multiplier = 1./9.
            elif tempMult == '1/8':
                multiplier = 1./8.
            elif tempMult == '1/7':
                multiplier = 1./7.
            elif tempMult == '1/6':
                multiplier = 1./6.
            elif tempMult == '1/5':
                multiplier = 1./5.
            elif tempMult == '1/4':
                multiplier = 1./4.
            elif tempMult == '1/3':
                multiplier = 1./3.
            elif tempMult == '1/2':
                multiplier = 1./2.
            elif tempMult == '2':
                multiplier = 2.
            elif tempMult == '3':
                multiplier = 3.
            elif tempMult == '4':
                multiplier = 4.
            elif tempMult == '5':
                multiplier = 5.
            elif tempMult == '6':
                multiplier = 6.
            elif tempMult == '7':
                multiplier = 7.
            elif tempMult == '8':
                multiplier = 8.
            elif tempMult == '9':
                multiplier = 9.
            elif tempMult == '10':
                multiplier = 10.
            elif tempMult.count('/') == 1:
# just one division sign is present in string, so try arbitrary fraction; if fails, nothing left to try
                tempMult_New = tempMult.split('/')
                try:
                    multiplier = float(tempMult_New[0]) / float(tempMult_New[1])
                except:
                # form error string
                    selfExt.MySQL_Output(
                        1,
                        stringInvalidMultiplier
                        )
                    showinfo(
                        'Error: invalid value',
                        '\n' + stringInvalidMultiplier + '\n'
                        )
                    return               
            else:
# last ditch chance to just float the string representing a number; if fails, nothing left to try
                try:
                    multiplier = float(valueRefCurveMultiplier)
                except:                   
                    selfExt.MySQL_Output(
                        1,
                        stringInvalidMultiplier
                        )
                    showinfo(
                        'Error: invalid value',
                        '\n' + stringInvalidMultiplier + '\n'
                        )
                    return
                    
# choose correct X-values for reference curve
            plot_X_RefCurve = valuesRefCurvePlotXList
            plot_Y_RefCurve = [float(y)*float(multiplier) for y in valuesRefCurvePlotYList]
            
# ... set up plots   
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                plot_X_RefCurve,
                plot_Y_RefCurve,
                'r--d',
                lineWidth,
                markerSize,
                plotBaseX,
                plotBaseY,
                )    

            module_PlotUtilities.globalMinMaxValues(
                self,plot_X_RefCurve,plot_Y_RefCurve
                )
            
# sloped straight-line reference curve, if desired
        if showSlopedStraightLineReferenceCurve:
        
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                valuesSlopedStraightLineRefCurvePlotXList,
                valuesSlopedStraightLineRefCurvePlotYList,
                'r--s',
                lineWidth,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                valuesSlopedStraightLineRefCurvePlotXList,
                valuesSlopedStraightLineRefCurvePlotYList
                )
                
# horizontal straight-line reference curve, if desired
        if showHorizontalStraightLineReferenceCurve:
# ... no need to error check; validation done in "X-Y PLOTTING SPECS" window 
       
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                valuesHorizontalStraightLineRefCurvePlotXList,
                valuesHorizontalStraightLineRefCurvePlotYList,
                'r--s',
                lineWidth,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                valuesHorizontalStraightLineRefCurvePlotXList,
                valuesHorizontalStraightLineRefCurvePlotYList
                )
                
# vertical straight-line reference curve, if desired
        if showVerticalStraightLineReferenceCurve:
        
            module_PlotUtilities.plotStyleForCurve(
                self,
                pylab,
                plotStyle,
                valuesVerticalStraightLineRefCurvePlotXList,
                valuesVerticalStraightLineRefCurvePlotYList,
                'r--s',
                lineWidth,
                markerSize,
                plotBaseX,
                plotBaseY,
                )
                
            module_PlotUtilities.globalMinMaxValues(
                self,
                valuesVerticalStraightLineRefCurvePlotXList,
                valuesVerticalStraightLineRefCurvePlotYList
                ) 
                    
# display legend
#        print '\nself.legend_buttonStatus = %s\n' % self.legend_buttonStatus
        if showLegend:
            if DEBUG:
                print '\n====\nvaluesLegendLabels:\n',valuesLegendLabels
# set legend shadow
            stringLegendShadow = 'True'
# legend labels
            stringLegendLabels = []
#            lenLabels = len(self.plot_Labels)
            lenLabels = len(valuesLegendLabels)
#            for label in self.plot_Labels:
            for label in valuesLegendLabels:
                stringLegendLabels.append(label)
                
            if showReferenceCurve:
# include reference curve in legend
#                stringLegendLabels.append(str(multiplier) + ' * ' + self.refCurveLabel)
                stringLegendLabels.append(
                    str(valueRefCurveMultiplier) + ' * (' + valueRefCurveLabel +
                    ') [ref]'
                    )
                    
            if showSlopedStraightLineReferenceCurve:
# include horizontal straight-line reference curve in legend
                stringLegendLabels.append(
#                    'straight line [ref]'
                    valueSlopedStraightLineRefCurveLabel
                    )

            if showHorizontalStraightLineReferenceCurve:
# include horizontal straight-line reference curve in legend
                stringLegendLabels.append(
#                    'straight line [ref]'
                    valueHorizontalStraightLineRefCurveLabel
                    )
                    
            if showVerticalStraightLineReferenceCurve:
# include vertical straight-line reference curve in legend
                stringLegendLabels.append(
#                    'straight line [ref]'
                    valueVerticalStraightLineRefCurveLabel
                    )

# form legend
            pylab.legend(
                tuple(stringLegendLabels), 
                loc=valueLegendLocation, 
                shadow=stringLegendShadow
                )
                
        if plotStyle == 'semilogx' or plotStyle == 'loglog':
            if plotBaseX == 'e':
                xMin_Local = min(self.xMin_Global)
                xMax_Local = max(self.xMax_Global)
                okXLabels = module_PlotUtilities.formNewXLabels(
                    self,pylab,xMin_Local,xMax_Local,colorXTicks,fontsizeXTicks
                    )
                if not okXLabels:
                        return
            
        if plotStyle == 'semilogy' or plotStyle == 'loglog':
            if plotBaseY == 'e':
                yMin_Local = min(self.yMin_Global)
                yMax_Local = max(self.yMax_Global)
                okYLabels = module_PlotUtilities.formNewYLabels(
                    self,pylab,yMin_Local,yMax_Local,colorYTicks,fontsizeYTicks
                    )  
                if not okYLabels:
                        return
                        
# graph the plot
        pylab.show()
        
        return