figTest.py 1.44 KB
Newer Older
Yori Fournier's avatar
Yori Fournier committed
1
# IMPORT ---------------------------------------------------------------
2
3
from myplotlib import MyFig
from axTest import AxTest
Yori Fournier's avatar
Yori Fournier committed
4

5
class FigTest(MyFig):                                                  
Yori Fournier's avatar
Yori Fournier committed
6
7
8
9
10
11
12
13
  
    FIGSIZE = (8., 6.)
    
    def addAxes(self):
        
        ratio = 6. / 8.  # height/width of the axes (in inch)
        frame1 = [0.1, 0.1, 0.8, 0.8]  # part of the fig that is available
        
14
        self.add_axes(AxTest(self, ratio, frame1), "p1")
15
16
17
18
19
20
21
22
23
24
25
26
27

class FigTest2(MyFig):                                                  # Fig with two Axes
  
    # Set the size of the Figure in inch
    # (private variable can not be updated)
    FIGSIZE = (8., 6.)
    
    def addAxes(self):
        
        ratio = 6. / 8.  # height/width of the axes (in inch)
        frame1 = [0.1, 0.1, 0.4, 0.8]  # part of the fig that is available
        frame2 = [0.6, 0.1, 0.4, 0.8]  # part of the fig that is available
        
28
29
        self.add_axes(AxTest(self, ratio, frame1),"p1")
        self.add_axes(AxTest(self, ratio, frame2),"p2")
30
31
32
33
34
35
36
37
38
39
40
41
        
    def declareAliases(self):
        
        # it is important to not hold additional references to an axes in the figure to avoid memory leaks. use the this function
        # get the plot added above
        p1 = self.getAxesByName("p1")
        p2 = self.getAxesByName("p2")
        
        self.aliases = {'xRange_p1': (p1, "xRange"),
                        'xRange_p2': (p2, "xRange")}
        
        return(True)