forked from lmbelo/python4delphi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFormSVG.dfm
More file actions
290 lines (282 loc) · 7.91 KB
/
Copy pathMainFormSVG.dfm
File metadata and controls
290 lines (282 loc) · 7.91 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Python Chats to Svg'
ClientHeight = 613
ClientWidth = 1035
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Splitter1: TSplitter
Left = 489
Top = 0
Height = 613
ExplicitLeft = 528
ExplicitTop = 280
ExplicitHeight = 100
end
object SVGIconImage1: TSVGIconImage
Left = 960
Top = 520
Width = 100
Height = 41
AutoSize = False
end
object SVGIconImage: TSVGIconImage
Left = 492
Top = 0
Width = 543
Height = 613
AutoSize = False
ParentDoubleBuffered = False
DoubleBuffered = True
Align = alClient
end
object PageControl1: TPageControl
Left = 0
Top = 0
Width = 489
Height = 613
ActivePage = TabSheet1
Align = alLeft
TabOrder = 2
object TabSheet1: TTabSheet
Caption = 'matplotlib'
object Panel1: TPanel
Left = 0
Top = 0
Width = 481
Height = 585
Align = alClient
TabOrder = 0
object Splitter2: TSplitter
Left = 1
Top = 445
Width = 479
Height = 3
Cursor = crVSplit
Align = alBottom
ExplicitTop = 10
ExplicitWidth = 492
end
object SynEdit1: TSynEdit
Left = 1
Top = 1
Width = 479
Height = 444
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Consolas'
Font.Style = []
Font.Quality = fqClearTypeNatural
TabOrder = 0
UseCodeFolding = False
Gutter.Font.Charset = DEFAULT_CHARSET
Gutter.Font.Color = clWindowText
Gutter.Font.Height = -11
Gutter.Font.Name = 'Consolas'
Gutter.Font.Style = []
Highlighter = SynPythonSyn1
Lines.Strings = (
'from delphi_module import svg_image'
'from io import StringIO'
'import numpy as np'
'import matplotlib.pyplot as plt'
'import matplotlib.cbook as cbook'
''
'# Load a numpy record array from yahoo csv data with fields date' +
', open, close,'
'# volume, adj_close from the mpl-data/example directory. The rec' +
'ord array'
'# stores the date as an np.datetime64 with a day unit ('#39'D'#39') in t' +
'he date column.'
'price_data = (cbook.get_sample_data('#39'goog.npz'#39', np_load=True)['#39'p' +
'rice_data'#39']'
' .view(np.recarray))'
'price_data = price_data[-250:] # get the most recent 250 tradin' +
'g days'
''
'delta1 = np.diff(price_data.adj_close) / price_data.adj_close[:-' +
'1]'
''
'# Marker size in units of points^2'
'volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2'
'close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[' +
':-2]'
''
'fig, ax = plt.subplots()'
'ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5' +
')'
''
'ax.set_xlabel(r'#39'$\Delta_i$'#39', fontsize=15)'
'ax.set_ylabel(r'#39'$\Delta_{i+1}$'#39', fontsize=15)'
'ax.set_title('#39'Volume and percent change'#39')'
''
'ax.grid(True)'
'fig.tight_layout()'
''
'figfile = StringIO()'
'fig.savefig(figfile, format='#39'svg'#39')'
'figdata_svg = figfile.getvalue()'
'svg_image.SvgText = figdata_svg'
''
'#plt.show()')
end
object Panel2: TPanel
Left = 1
Top = 543
Width = 479
Height = 41
Align = alBottom
TabOrder = 1
object Button1: TButton
Left = 24
Top = 6
Width = 75
Height = 25
Caption = 'Run'
TabOrder = 0
OnClick = Button1Click
end
end
object Memo1: TMemo
Left = 1
Top = 448
Width = 479
Height = 95
Align = alBottom
TabOrder = 2
end
end
end
object TabSheet3: TTabSheet
Caption = 'seaborn'
ImageIndex = 2
object Panel5: TPanel
Left = 0
Top = 0
Width = 481
Height = 585
Align = alClient
TabOrder = 0
object Splitter6: TSplitter
Left = 1
Top = 377
Width = 479
Height = 3
Cursor = crVSplit
Align = alBottom
ExplicitTop = 151
ExplicitWidth = 433
end
object SynEdit2: TSynEdit
Left = 1
Top = 1
Width = 479
Height = 376
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Consolas'
Font.Style = []
Font.Quality = fqClearTypeNatural
TabOrder = 0
UseCodeFolding = False
Gutter.Font.Charset = DEFAULT_CHARSET
Gutter.Font.Color = clWindowText
Gutter.Font.Height = -11
Gutter.Font.Name = 'Consolas'
Gutter.Font.Style = []
Highlighter = SynPythonSyn1
Lines.Strings = (
'from delphi_module import svg_image'
'from io import StringIO'
'import seaborn as sns'
'import matplotlib.pyplot as plt'
''
'df = sns.load_dataset("penguins")'
'sns.pairplot(df, hue="species")'
''
'figfile = StringIO()'
'plt.savefig(figfile, format='#39'svg'#39')'
'figdata_svg = figfile.getvalue()'
'svg_image.SvgText = figdata_svg'
''
'#plt.show()'
'')
end
object Panel6: TPanel
Left = 1
Top = 543
Width = 479
Height = 41
Align = alBottom
TabOrder = 1
object Button3: TButton
Left = 24
Top = 6
Width = 75
Height = 25
Caption = 'Run'
TabOrder = 0
OnClick = Button1Click
end
end
object Memo2: TMemo
Left = 1
Top = 380
Width = 479
Height = 163
Align = alBottom
TabOrder = 2
end
end
end
end
object SynPythonSyn1: TSynPythonSyn
Options.AutoDetectEnabled = False
Options.AutoDetectLineLimit = 0
Options.Visible = False
Left = 632
Top = 40
end
object SynEditPythonBehaviour1: TSynEditPythonBehaviour
Editor = SynEdit2
Left = 628
Top = 89
end
object PythonEngine1: TPythonEngine
IO = PythonGUIInputOutput1
Left = 632
Top = 136
end
object PythonGUIInputOutput1: TPythonGUIInputOutput
UnicodeIO = True
RawOutput = False
Left = 632
Top = 184
end
object PythonModule: TPythonModule
Engine = PythonEngine1
ModuleName = 'delphi_module'
Errors = <>
Left = 632
Top = 232
end
object PyDelphiWrapper: TPyDelphiWrapper
Engine = PythonEngine1
Module = PythonModule
Left = 632
Top = 280
end
end