Commit 27062aa4 authored by eric pellegrini's avatar eric pellegrini
Browse files

Fix bug due to matplotlib backcompatibility

parent fdb9294c
Pipeline #4232 passed with stages
in 9 minutes and 10 seconds
...@@ -30,10 +30,12 @@ Created on Apr 10, 2015 ...@@ -30,10 +30,12 @@ Created on Apr 10, 2015
:author: Gael Goret, Bachir Aoun, Eric C. Pellegrini :author: Gael Goret, Bachir Aoun, Eric C. Pellegrini
''' '''
from distutils.version import LooseVersion
import os import os
import numpy import numpy
import matplotlib
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, NavigationToolbar2WxAgg from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, NavigationToolbar2WxAgg
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.colors import LogNorm, Normalize from matplotlib.colors import LogNorm, Normalize
...@@ -64,7 +66,11 @@ class Plotter1D(wx.Panel): ...@@ -64,7 +66,11 @@ class Plotter1D(wx.Panel):
### Initialize variables ### ### Initialize variables ###
self.parent = parent self.parent = parent
self.figure = Figure(figsize=(5,4), dpi=None) self.figure = Figure(figsize=(5,4), dpi=None)
self.axes = self.figure.add_axes( (10,10,10,10), frameon=True, facecolor='b')
if LooseVersion(matplotlib.__version__) < LooseVersion("2.0.0"):
self.axes = self.figure.add_axes( (10,10,10,10), frameon=True, axis_bgcolor='b')
else:
self.axes = self.figure.add_axes( (10,10,10,10), frameon=True, facecolor='b')
self.canvas = FigureCanvasWxAgg( self, wx.ID_ANY, self.figure ) self.canvas = FigureCanvasWxAgg( self, wx.ID_ANY, self.figure )
self.toolbar = NavigationToolbar2WxAgg(self.canvas) self.toolbar = NavigationToolbar2WxAgg(self.canvas)
self.plots = {} self.plots = {}
...@@ -530,4 +536,4 @@ class Plotter1D(wx.Panel): ...@@ -530,4 +536,4 @@ class Plotter1D(wx.Panel):
d = LinesSettingsDialog(self) d = LinesSettingsDialog(self)
d.SetFocus() d.SetFocus()
d.ShowModal() d.ShowModal()
d.Destroy() d.Destroy()
\ No newline at end of file
...@@ -31,9 +31,11 @@ Created on Apr 10, 2015 ...@@ -31,9 +31,11 @@ Created on Apr 10, 2015
''' '''
import collections import collections
from distutils.version import LooseVersion
import numpy import numpy
import matplotlib
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, NavigationToolbar2WxAgg from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, NavigationToolbar2WxAgg
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.colors import LogNorm, Normalize from matplotlib.colors import LogNorm, Normalize
...@@ -76,7 +78,10 @@ class Plotter2D(wx.Panel): ...@@ -76,7 +78,10 @@ class Plotter2D(wx.Panel):
### Initialize variables ### ### Initialize variables ###
self.parent = parent self.parent = parent
self.figure = Figure(figsize=(5,4), dpi=None) self.figure = Figure(figsize=(5,4), dpi=None)
self.axes = self.figure.add_axes( (10,10,10,10), frameon=True, facecolor='b') if LooseVersion(matplotlib.__version__) < LooseVersion("2.0.0"):
self.axes = self.figure.add_axes( (10,10,10,10), frameon=True, axis_bgcolor='b')
else:
self.axes = self.figure.add_axes( (10,10,10,10), frameon=True, facecolor='b')
self.canvas = FigureCanvasWxAgg( self, wx.ID_ANY, self.figure ) self.canvas = FigureCanvasWxAgg( self, wx.ID_ANY, self.figure )
self.toolbar = NavigationToolbar2WxAgg(self.canvas) self.toolbar = NavigationToolbar2WxAgg(self.canvas)
self.ax = None self.ax = None
...@@ -580,4 +585,4 @@ class Plotter2D(wx.Panel): ...@@ -580,4 +585,4 @@ class Plotter2D(wx.Panel):
d = ImageSettingsDialog(self) d = ImageSettingsDialog(self)
d.SetFocus() d.SetFocus()
d.ShowModal() d.ShowModal()
d.Destroy() d.Destroy()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment