#!/usr/bin/python # -*- coding: utf-8 -*- # # ================= FILE HEADER ======================================== # # myplotlib v1.0.1, # # @file myFig.py # @author Yori 'AGy' Fournier # @licence CC-BY-SA # # MyFig class: Overlay of matplotlib Figure class # It is done such that the user can concentrate on # the important aspect of the figure and not the # technical part. # # @Class MyFig # # @Constructor # # fignum: number of the Figure. # inputarg: identifier of the raw data in G_RAWDATA. # reformat: flag for reComputing plotted data # from rawData. # debug: flag for debugging, more verbatile. # (kw)args: user defined arguments and keywords. # # @section Functions # # - printDebug: print some debug information. # # - plot: overlay of Figure.plot() function, # should be overwrited by the user. # Consists of # - creating axes, # - formating the data, # - adding the axis to the figure # - plotting the axis # # - update: update the parameters in the # keywords dictionary. # # @section History # # v 0.1.1 - MyFig class for the myplotlib module. # # v 1.0.0 - Changed rawdata with inputarg to allows any type # of rawdata, can be an array. # # replace the attribute format (reserved word) with # formatted. # # v 1.0.1 - Suppress the explicit definitions of the keywords. # by the introduction of the keywords dictionary. # All parameters in this dictionary are automatically # updated. # # suppress the default value of fignum and hardcode it # to be -1. # # add the attribute boundedToWin required for the # interactive mode of myplotlib. # # ====================================================================== # # # IMPORT --------------------------------------------------------------- from .. import os from .. import DBUG, SEVR, INFO, SPCE, WARN from .. import MyFig from .axTest1 import AxTest1 D_XRANGE = [-1, 1] D_YRANGE = [-2, 2] # Class MyFig Overwriting Matplotlib.figure.Figure class FigTest1(MyFig): # Set the size of the Figure in inch # (private variable can not be updated) FIGSIZE = (8., 6.) # CONSTRUCTOR -------------------------------------------------------- def __init__(self, *args, **kwargs): # parent constructor MyFig.__init__(self, *args, **kwargs) self.keywords.update({'xRange': D_XRANGE, 'yRange': D_YRANGE}) ratio = 6. / 8. # height/width of the axes (in inch) frame = [0.0, 0.0, 1.0, 1.0] # part of the fig that is available self.add_axes(AxTest1(self, ratio, frame, *args, **kwargs))