[GRASS-SVN] r59332 - grass/trunk/gui/wxpython/wxplot
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 25 08:12:48 PDT 2014
Author: turek
Date: 2014-03-25 08:12:47 -0700 (Tue, 25 Mar 2014)
New Revision: 59332
Modified:
grass/trunk/gui/wxpython/wxplot/base.py
grass/trunk/gui/wxpython/wxplot/dialogs.py
Log:
wxplot hist: if log scale is chosen show it in plot labels
Modified: grass/trunk/gui/wxpython/wxplot/base.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/base.py 2014-03-25 15:12:09 UTC (rev 59331)
+++ grass/trunk/gui/wxpython/wxplot/base.py 2014-03-25 15:12:47 UTC (rev 59332)
@@ -106,7 +106,6 @@
self._createColorDict()
-
def _createColorDict(self):
"""!Create color dictionary to return wx.Colour tuples
for assigning colors to images in imagery groups"""
@@ -362,10 +361,11 @@
def DrawPlot(self, plotlist):
"""!Draw line and point plot from list plot elements.
"""
+ xlabel, ylabel = self._getPlotLabels()
self.plot = plot.PlotGraphics(plotlist,
self.ptitle,
- self.xlabel,
- self.ylabel)
+ xlabel,
+ ylabel)
if self.properties['x-axis']['prop']['type'] == 'custom':
self.client.SetXSpec('min')
@@ -421,6 +421,7 @@
def OnRedraw(self, event):
"""!Redraw the plot window. Unzoom to original size
"""
+ self.UpdateLabels()
self.client.Reset()
self.client.Redraw()
@@ -487,6 +488,21 @@
dlg.ShowModal()
dlg.Destroy()
+
+ def _getPlotLabels(self):
+ def log(txt):
+ return "log( " + txt + " )"
+
+ x = self.xlabel
+ if self.properties['x-axis']['prop']['log']:
+ x = log(x)
+
+ y = self.ylabel
+ if self.properties['y-axis']['prop']['log']:
+ y = log(y)
+
+ return x, y
+
def OnPlotText(self, dlg):
"""!Custom text settings for histogram plot.
"""
@@ -494,17 +510,22 @@
self.xlabel = dlg.xlabel
self.ylabel = dlg.ylabel
+ if self.plot:
+ self.plot.setTitle(dlg.ptitle)
+
+ self.OnRedraw(event = None)
+
+ def UpdateLabels(self):
+ x, y = self._getPlotLabels()
+
self.client.SetFont(self.properties['font']['wxfont'])
self.client.SetFontSizeTitle(self.properties['font']['prop']['titleSize'])
self.client.SetFontSizeAxis(self.properties['font']['prop']['axisSize'])
if self.plot:
- self.plot.setTitle(dlg.ptitle)
- self.plot.setXLabel(dlg.xlabel)
- self.plot.setYLabel(dlg.ylabel)
+ self.plot.setXLabel(x)
+ self.plot.setYLabel(y)
- self.OnRedraw(event = None)
-
def PlotText(self, event):
"""!Set custom text values for profile title and axis labels.
"""
Modified: grass/trunk/gui/wxpython/wxplot/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/dialogs.py 2014-03-25 15:12:09 UTC (rev 59331)
+++ grass/trunk/gui/wxpython/wxplot/dialogs.py 2014-03-25 15:12:47 UTC (rev 59332)
@@ -1235,6 +1235,8 @@
self.properties['font']['prop']['legendSize'] = self.FindWindowById(self.wxId['font']['legendSize']).GetValue()
self.properties['legend']['enabled'] = self.FindWindowById(self.wxId['legend']['enabled']).IsChecked()
+ self.parent.UpdateLabels()
+
def OnSave(self, event):
"""!Button 'Save' pressed"""
self.OnApply(None)
More information about the grass-commit
mailing list