figTest1.py 3.04 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/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))