From 8cb31860490ef31023443ab44cb496203701ef51 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 1 Mar 2007 01:26:13 +0000 Subject: [PATCH] wx.lib.plot: patch #1663937 to allow user to turn off scientific notation on plot. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/docs/CHANGES.txt | 3 +++ wxPython/wx/lib/plot.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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))