diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index 8c427e89ff..ce1cd39b02 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -32,6 +32,9 @@ you can now write:: Will Sadkin provided a patch for the wx.lib.masked package that fixes its support for using the navigation keys on the numeric keypad. +wx.lib.plot: patch #1663937 to allow user to turn off scientific +notation on plot. + diff --git a/wxPython/wx/lib/plot.py b/wxPython/wx/lib/plot.py index 0e5d01f1ec..7bb44770e5 100644 --- a/wxPython/wx/lib/plot.py +++ b/wxPython/wx/lib/plot.py @@ -567,6 +567,8 @@ class PlotCanvas(wx.Panel): self._pointLabelFunc= None self.canvas.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) + self._useScientificNotation = False + self.canvas.Bind(wx.EVT_PAINT, self.OnPaint) self.canvas.Bind(wx.EVT_SIZE, self.OnSize) # OnSize called to make sure the buffer is initialized. @@ -746,6 +748,12 @@ class PlotCanvas(wx.Panel): """Set True to show scrollbars""" return self.sb_vert.IsShown() + def SetUseScientificNotation(self, useScientificNotation): + self._useScientificNotation = useScientificNotation + + def GetUseScientificNotation(self): + return self._useScientificNotation + def SetEnableDrag(self, value): """Set True to enable drag.""" if value not in [True,False]: @@ -1565,7 +1573,7 @@ class PlotCanvas(wx.Panel): error = e factor = f grid = factor * 10.**power - if power > 4 or power < -4: + if self._useScientificNotation and (power > 4 or power < -4): format = '%+7.1e' elif power >= 0: digits = max(1, int(power))