|
@@ -17,7 +17,8 @@ class MyMplCanvas(FigureCanvas):
|
17
|
17
|
"""Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
|
18
|
18
|
def __init__(self, parent=None, width=3, height=4, dpi=100):
|
19
|
19
|
|
20
|
|
- self.fig = Figure(figsize=(width, height), dpi=dpi)
|
|
20
|
+ self.fig = Figure(figsize=(width, height), dpi=dpi, facecolor='darkgrey') # this fucking works...why?
|
|
21
|
+ #self.fig.patch.set_facecolor('blue')
|
21
|
22
|
FigureCanvas.__init__(self, self.fig)
|
22
|
23
|
|
23
|
24
|
self.setParent(parent)
|
|
@@ -33,35 +34,43 @@ class MyDynamicMplCanvas(MyMplCanvas):
|
33
|
34
|
|
34
|
35
|
"""A canvas that updates itself every second with a new plot."""
|
35
|
36
|
def __init__(self, *args, **kwargs):
|
36
|
|
-
|
37
|
37
|
MyMplCanvas.__init__(self, *args, **kwargs)
|
38
|
38
|
self.ax1 = self.fig.add_axes([.125,.1,.725,.8])
|
39
|
39
|
self.ax2 = self.ax1.twinx() # fig.add_axes([.125,.1,.725,.8])
|
40
|
40
|
self.compute_initial_figure()
|
41
|
41
|
|
42
|
42
|
def reAxH(self, num, shx=True, shy=True):
|
|
43
|
+
|
|
44
|
+ try:
|
|
45
|
+ for ax in fig.axes:
|
|
46
|
+ self.fig.delaxes(ax)
|
|
47
|
+ except:
|
|
48
|
+ pass
|
43
|
49
|
try:
|
44
|
50
|
self.fig.clear()
|
45
|
51
|
except:
|
46
|
52
|
pass
|
|
53
|
+
|
47
|
54
|
for n in range(num):
|
48
|
55
|
if n == 0:
|
49
|
|
- self.ax1 = self.fig.add_subplot( 1, num, 1 )
|
|
56
|
+ self.ax1 = self.fig.add_subplot( 1, num, 1)
|
50
|
57
|
self.ax1.tick_params(axis='both', which='major', labelsize=8)
|
51
|
58
|
self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
|
59
|
+ self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='x')
|
52
|
60
|
self.ax1.yaxis.get_offset_text().set_size(8)
|
|
61
|
+ self.ax1.xaxis.get_offset_text().set_size(8)
|
53
|
62
|
if n == 1:
|
54
|
|
- self.ax2 = self.fig.add_subplot( 1, num, 2 )
|
|
63
|
+ self.ax2 = self.fig.add_subplot( 1, num, 2)
|
55
|
64
|
self.ax2.tick_params(axis='both', which='major', labelsize=8)
|
56
|
65
|
self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
57
|
66
|
self.ax2.yaxis.get_offset_text().set_size(8)
|
58
|
67
|
if n == 2:
|
59
|
|
- self.ax3 = self.fig.add_subplot( 1, num, 3 )
|
|
68
|
+ self.ax3 = self.fig.add_subplot( 1, num, 3)
|
60
|
69
|
self.ax3.tick_params(axis='both', which='major', labelsize=8)
|
61
|
70
|
self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
62
|
71
|
self.ax3.yaxis.get_offset_text().set_size(8)
|
63
|
72
|
if n == 3:
|
64
|
|
- self.ax4 = self.fig.add_subplot( 1, num, 4 )
|
|
73
|
+ self.ax4 = self.fig.add_subplot( 1, num, 4)
|
65
|
74
|
self.ax4.tick_params(axis='both', which='major', labelsize=8)
|
66
|
75
|
self.ax4.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
67
|
76
|
self.ax4.yaxis.get_offset_text().set_size(8)
|
|
@@ -72,7 +81,6 @@ class MyDynamicMplCanvas(MyMplCanvas):
|
72
|
81
|
self.fig.delaxes(ax)
|
73
|
82
|
except:
|
74
|
83
|
pass
|
75
|
|
-
|
76
|
84
|
try:
|
77
|
85
|
self.fig.clear()
|
78
|
86
|
except:
|
|
@@ -80,29 +88,29 @@ class MyDynamicMplCanvas(MyMplCanvas):
|
80
|
88
|
|
81
|
89
|
for n in range(num):
|
82
|
90
|
if n == 0:
|
83
|
|
- self.ax1 = self.fig.add_subplot( 2, num, 1 )
|
|
91
|
+ self.ax1 = self.fig.add_subplot( 2, num, 1)
|
84
|
92
|
self.ax1.tick_params(axis='both', which='major', labelsize=8)
|
85
|
93
|
self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
86
|
94
|
self.ax1.yaxis.get_offset_text().set_size(8)
|
87
|
|
- self.ax21 = self.fig.add_subplot( 2, num, num+1 )
|
|
95
|
+ self.ax21 = self.fig.add_subplot( 2, num, num+1)
|
88
|
96
|
self.ax21.tick_params(axis='both', which='major', labelsize=8)
|
89
|
97
|
self.ax21.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
90
|
98
|
self.ax21.yaxis.get_offset_text().set_size(8)
|
91
|
99
|
if n == 1:
|
92
|
|
- self.ax2 = self.fig.add_subplot( 2, num, 2, sharex=self.ax1, sharey=self.ax1 )
|
|
100
|
+ self.ax2 = self.fig.add_subplot( 2, num, 2, sharex=self.ax1, sharey=self.ax1)
|
93
|
101
|
self.ax2.tick_params(axis='both', which='major', labelsize=8)
|
94
|
102
|
self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
95
|
103
|
self.ax2.yaxis.get_offset_text().set_size(8)
|
96
|
|
- self.ax22 = self.fig.add_subplot( 2, num, num+2, sharex=self.ax21, sharey=self.ax21 )
|
|
104
|
+ self.ax22 = self.fig.add_subplot( 2, num, num+2, sharex=self.ax21, sharey=self.ax21)
|
97
|
105
|
self.ax22.tick_params(axis='both', which='major', labelsize=8)
|
98
|
106
|
self.ax22.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
99
|
107
|
self.ax22.yaxis.get_offset_text().set_size(8)
|
100
|
108
|
if n == 2:
|
101
|
|
- self.ax3 = self.fig.add_subplot( 2, num, 3, sharex=self.ax1, sharey=self.ax1 )
|
|
109
|
+ self.ax3 = self.fig.add_subplot( 2, num, 3, sharex=self.ax1, sharey=self.ax1)
|
102
|
110
|
self.ax3.tick_params(axis='both', which='major', labelsize=8)
|
103
|
111
|
self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
104
|
112
|
self.ax3.yaxis.get_offset_text().set_size(8)
|
105
|
|
- self.ax23 = self.fig.add_subplot( 2, num, num+3, sharex=self.ax21, sharey=self.ax21 )
|
|
113
|
+ self.ax23 = self.fig.add_subplot( 2, num, num+3, sharex=self.ax21, sharey=self.ax21)
|
106
|
114
|
self.ax23.tick_params(axis='both', which='major', labelsize=8)
|
107
|
115
|
self.ax23.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
108
|
116
|
self.ax23.yaxis.get_offset_text().set_size(8)
|
|
@@ -176,6 +184,7 @@ class MyDynamicMplCanvas(MyMplCanvas):
|
176
|
184
|
except:
|
177
|
185
|
pass
|
178
|
186
|
|
|
187
|
+ #self.fig.patch.set_facecolor('red')
|
179
|
188
|
self.ax1 = self.fig.add_subplot(211)
|
180
|
189
|
if shx and shy:
|
181
|
190
|
self.ax2 = self.fig.add_subplot(212, sharex=self.ax1, sharey=self.ax1)
|
|
@@ -232,6 +241,13 @@ class MyDynamicMplCanvas(MyMplCanvas):
|
232
|
241
|
|
233
|
242
|
self.ax3 = self.ax1.twinx()
|
234
|
243
|
|
|
244
|
+ #self.ax1.set_facecolor('red')
|
|
245
|
+ #self.ax2.set_facecolor('red')
|
|
246
|
+ #self.ax3.set_facecolor('red')
|
|
247
|
+ #self.fig.set_facecolor('red')
|
|
248
|
+ #self.fig.set_edgecolor('red')
|
|
249
|
+ #self.ax1.set_axis_bgcolor('green')
|
|
250
|
+
|
235
|
251
|
self.ax1.tick_params(axis='both', which='major', labelsize=8)
|
236
|
252
|
self.ax2.tick_params(axis='both', which='major', labelsize=8)
|
237
|
253
|
self.ax3.tick_params(axis='both', which='major', labelsize=8)
|