from ginga.qtw.QtHelp import QtGui, QtCore
from ginga.qtw import QtHelp
from ginga.toolkit import toolkit

import matplotlib
if toolkit in ('qt', 'qt4'):
    from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
         as FigureCanvas
elif toolkit == 'qt5':
    # qt5 backend is not yet released in matplotlib stable
    from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
         as FigureCanvas

from ginga.base.PlotBase import PlotBase, HistogramMixin, CutsMixin

class Plot(PlotBase):

    def __init__(self, logger, width=300, height=300, dpi=100):
        PlotBase.__init__(self, logger, FigureCanvas,
                          width=width, height=height, dpi=dpi)

class Histogram(Plot, HistogramMixin):
    pass

class Cuts(Plot, CutsMixin):
    pass

#END

from ginga.qtw.QtHelp import QtGui, QtCore
from ginga.qtw import QtHelp
from ginga.toolkit import toolkit

import matplotlib
if toolkit == 'qt5':
    # qt5 backend is not yet released in matplotlib stable
    from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
         as FigureCanvas
else:
    from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
         as FigureCanvas

from ginga.base.PlotBase import PlotBase, HistogramMixin, CutsMixin

class Plot(PlotBase):

    def __init__(self, logger, width=300, height=300, dpi=100):
        PlotBase.__init__(self, logger, FigureCanvas,
                          width=width, height=height, dpi=dpi)

class Histogram(Plot, HistogramMixin):
    pass

class Cuts(Plot, CutsMixin):
    pass

#END

Fix for import error with matplotlib Qt4Agg backend
Fix for import error with matplotlib Qt4Agg backend

  from ginga.qtw.QtHelp import QtGui, QtCore
  from ginga.qtw import QtHelp
  from ginga.toolkit import toolkit
  
  import matplotlib
- if toolkit in ('qt', 'qt4'):
-     from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
-          as FigureCanvas
- elif toolkit == 'qt5':
+ if toolkit == 'qt5':
      # qt5 backend is not yet released in matplotlib stable
      from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
+          as FigureCanvas
+ else:
+     from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
           as FigureCanvas
  
  from ginga.base.PlotBase import PlotBase, HistogramMixin, CutsMixin
  
  class Plot(PlotBase):
  
      def __init__(self, logger, width=300, height=300, dpi=100):
          PlotBase.__init__(self, logger, FigureCanvas,
                            width=width, height=height, dpi=dpi)
  
  class Histogram(Plot, HistogramMixin):
      pass
  
  class Cuts(Plot, CutsMixin):
      pass
  
  #END
  
Fix for import error with matplotlib Qt4Agg backend
## Code Before:
from ginga.qtw.QtHelp import QtGui, QtCore
from ginga.qtw import QtHelp
from ginga.toolkit import toolkit

import matplotlib
if toolkit in ('qt', 'qt4'):
    from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
         as FigureCanvas
elif toolkit == 'qt5':
    # qt5 backend is not yet released in matplotlib stable
    from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
         as FigureCanvas

from ginga.base.PlotBase import PlotBase, HistogramMixin, CutsMixin

class Plot(PlotBase):

    def __init__(self, logger, width=300, height=300, dpi=100):
        PlotBase.__init__(self, logger, FigureCanvas,
                          width=width, height=height, dpi=dpi)

class Histogram(Plot, HistogramMixin):
    pass

class Cuts(Plot, CutsMixin):
    pass

#END

## Instruction:
Fix for import error with matplotlib Qt4Agg backend
## Code After:
from ginga.qtw.QtHelp import QtGui, QtCore
from ginga.qtw import QtHelp
from ginga.toolkit import toolkit

import matplotlib
if toolkit == 'qt5':
    # qt5 backend is not yet released in matplotlib stable
    from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
         as FigureCanvas
else:
    from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
         as FigureCanvas

from ginga.base.PlotBase import PlotBase, HistogramMixin, CutsMixin

class Plot(PlotBase):

    def __init__(self, logger, width=300, height=300, dpi=100):
        PlotBase.__init__(self, logger, FigureCanvas,
                          width=width, height=height, dpi=dpi)

class Histogram(Plot, HistogramMixin):
    pass

class Cuts(Plot, CutsMixin):
    pass

#END
