<commit_before>import warnings

import numpy as np

from ..qt import qt_api

try:
    import matplotlib as mpl
    from matplotlib.figure import Figure
    from matplotlib import _pylab_helpers
    from matplotlib.colors import LinearSegmentedColormap
    if qt_api is None:
        raise ImportError
    else:
        from matplotlib.backends.backend_qt4 import FigureManagerQT
        from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
except ImportError:
    FigureCanvasQTAgg = object  # hack to prevent nosetest and autodoc errors
    LinearSegmentedColormap = object
    print("Could not import matplotlib -- skimage.viewer not available.")

from ..qt import QtGui


__all__ = ['init_qtapp', 'start_qtapp', 'RequiredAttr', 'figimage',
           'LinearColormap', 'ClearColormap', 'FigureCanvas', 'new_plot',
           'update_axes_image']


QApp = None


def init_qtapp():
    """Initialize QAppliction.<commit_msg>Warn about matplotlib backend in skimage.viewer<commit_after>import warnings

import numpy as np

from ..qt import qt_api

try:
    import matplotlib as mpl
    from matplotlib.figure import Figure
    from matplotlib import _pylab_helpers
    from matplotlib.colors import LinearSegmentedColormap
    if qt_api is None:
        raise ImportError
    else:
        from matplotlib.backends.backend_qt4 import FigureManagerQT
        from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
    if 'agg' not in mpl.get_backend().lower():
        print("Recommended matplotlib backend is `Agg` for full "
              "skimage.viewer functionality.")
except ImportError:
    FigureCanvasQTAgg = object  # hack to prevent nosetest and autodoc errors
    LinearSegmentedColormap = object
    print("Could not import matplotlib -- skimage.viewer not available.")

from ..qt import QtGui


__all__ = ['init_qtapp', 'start_qtapp', 'RequiredAttr', 'figimage',
           'LinearColormap', 'ClearColormap', 'FigureCanvas', 'new_plot',
           'update_axes_image']


QApp = None


def init_qtapp():
    """Initialize QAppliction.
{'fraction_non_alphanumeric': 0.0725338491295938, 'fraction_numerical': 0.0019342359767891683, 'mean_word_length': 3.597777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602491', 'n_tokens_mistral': 629, 'n_tokens_neox': 625, 'n_words': 182}