Source code for titania.plots.base_plot
from abc import ABC, abstractmethod
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from PyQt5.QtWidgets import QWidget
from titania.common.interface_tab import TitaniaTabInterface
[docs]class PlotInterface(ABC):
"""
Basic plotting interface for titania
"""
[docs] @abstractmethod
def get_as_plot_widget(self) -> QWidget :
"""
If the plot is a more complex QWidget, it should return that widget
"""
pass
[docs]class BaseCanvasPlot(PlotInterface, FigureCanvas, metaclass=FinalMetaPlot):
def __init__(self, parent : QWidget = None, view : TitaniaTabInterface =None):
"""
Implements qt canvas with matplotlib
"""
plt.rcParams.update({'figure.max_open_warning': 0})
self.parent = parent
self.plot_number = 111
self.figure = plt.figure()
self.view = view
FigureCanvas.__init__(self, self.figure)