#!/usr/bin/python # -*- coding: utf-8 -*- # # ================= FILE HEADER ======================================== # # myplotlib v3.0.1, # # @file __init__.py # @author Yori 'AGy' Fournier # @licence CC-BY-SA # # Import and Configuration file for myplotlib # # @section Import # # myplotlib is base on matplotlib therefore it requires # Figure and Axes as main classes and a few further functions. # # @section Config # # Default value for user parameters # and configuration for the default plotting # # @section Module Import # # Import of myplotlib classes and function # # @section History # # v 0.0.0 - __init__.py file for the myplotlib module # # ====================================================================== # # # IMPORT --------------------------------------------------------------- from .config import INFO, WARN, SEVR, DBUG, SPCE import os as os import numpy as np # Test mpl version: from matplotlib import __version__ as mplvers if int(mplvers.replace('.','')[:3]) < 143 : print('\n\n' + WARN + 72*'=' + '\n' + SPCE + 'The matplotlib version you are using is not supported.\n' + SPCE + 'Most of myplotlib should work, but some stuff may not.\n' + SPCE + 'ex: expect an error with test203\n' + SPCE + 72*'=' + '\n\n') # matplotlib from matplotlib.pyplot import figure from matplotlib.pyplot import rc from matplotlib.pyplot import show, draw, ion, ioff, clf from matplotlib.pyplot import close as mpclose from matplotlib.pyplot import fignum_exists, savefig from matplotlib.axes import Axes from matplotlib.figure import Figure from matplotlib import is_interactive #from matplotlib import rcParams from matplotlib import use # myplotlib from .myData import MyData # GLOBAL VARIABLE ------------------------------------------------------ G_RAWDATAS = {'current': MyData()} # raw data Object _G_WINDOWS = [] # CONFIGURATION -------------------------------------------------------- from .config import D_FIGNUM, D_FIGSIZE, D_REFORMAT, D_FORMATTED from .config import D_RAWDATA, D_INPUTARG from .config import D_IPATH from .config import D_OPATH, D_OFORMAT from .config import D_DEBUG from .config import rcParams # FUNCTIONS ------------------------------------------------------------ # MyAxes: Overlay on matplotlib.Axes class from .myAxes import MyAxes # MyFig: Overlay on matplotlib.Figure class from .myFig import MyFig # MyFig: Overlay on matplotlib.FigureManager class if rcParams['backend'] == u'TkAgg': from .myWin_TkAgg import MyWin_TkAgg as MyWin elif rcParams['backend'] == u'GTKAgg': from .myWin_GTKAgg import MyWin_GTKAgg as MyWin elif rcParams['backend'] == u'WXAgg': from .myWin_WXAgg import MyWin_WXAgg as MyWin elif rcParams['backend'] == u'Qt4Agg': from .myWin_Qt4Agg import MyWin_Qt4Agg as MyWin elif rcParams['backend'] == u'MacOSX': from .myWin_MacOSx import MyWin_MacOSx as MyWin else: print(SEVR + "The backend you choosed is not supported interactive mode not available") # myTool.*: interface functions to use myplotlib interactively from .mytool import window_exists, getCurrentWindowIDs from .mytool import print2file, print2screen, printListCurrentWindows from .mytool import getWindow, getFigOnWindow, drawFigOnWindow, giveDataToWindow from .mytool import closeWindow, closeAllWindows from .mytool import FigOneAxes from .test import myTest # import the tests from .test import testList