MCPcopy Index your code
hub / github.com/QuantFans/quantdigger / plot_scatter

Function plot_scatter

quantdigger/widgets/mplotwidgets/stock_plot.py:291–345  ·  view source on GitHub ↗

docstring for plot_test

(fig, x, y, x2, y2, binnum)

Source from the content-addressed store, hash-verified

289
290
291def plot_scatter(fig, x, y, x2, y2, binnum):
292 '''docstring for plot_test'''
293 fig.canvas.set_window_title(u'�������ͼ')
294 # definitions for the axes
295 left, width = 0.1, 0.65
296 bottom, height = 0.1, 0.65
297 bottom_h = left_h = left+width+0.02
298
299 rect_scatter = [left, bottom, width, height]
300 rect_histx = [left, bottom_h, width, 0.2]
301 rect_histy = [left_h, bottom, 0.2, height]
302
303 # start with a rectangular Figure
304
305 axScatter = plt.axes(rect_scatter)
306 axHistx = plt.axes(rect_histx)
307 axHisty = plt.axes(rect_histy)
308 cursor = Cursor(axScatter, useblit=True, color='red', linewidth=1 )
309
310 axScatter.plot(x, y, 'o', color = 'red')
311 axScatter.plot(x2, y2, 'o', color = 'blue')
312
313 # now determine nice limits by hand:
314 xmax = np.max(x+x2)
315 xmin = np.min(x+x2)
316 binwidth = xmax / binnum
317 lim = ( int(xmax/binwidth) + 1) * binwidth
318 bins = np.arange(-lim, lim + binwidth, binwidth)
319 axHistx.hist(x+x2, bins=bins)
320
321 ymax = np.max(y+y2)
322 ymin = np.min(y+y2)
323 binwidth = ymax/binnum
324 lim = ( int(ymax/binwidth) + 1) * binwidth
325 bins = np.arange(-lim, lim + binwidth, binwidth)
326 axHisty.hist(y, bins=bins, orientation='horizontal', color = 'red' )
327 axHisty.hist(y2, bins=bins, orientation='horizontal', color = 'blue' )
328
329 xymax = np.max( [np.max(np.fabs(x+x2)), np.max(np.fabs(y+y2))] )
330 lim = ( int(xymax/binwidth) + 1) * binwidth
331 axScatter.axhline(color='black')
332
333 #axScatter.set_xlim( (-xmin-10, xmax+10))
334 #axScatter.set_ylim((-ymin-10, ymax+10))
335 axHistx.set_xlim( axScatter.get_xlim() )
336 axHisty.set_ylim( axScatter.get_ylim() )
337 axHisty.set_xlabel(u"ӯ���ֲ�", fontproperties = font_big)
338 axHistx.set_ylabel(u"���ڷֲ�", fontproperties = font_big)
339 axScatter.set_xlabel(u"ӯ�������ڷֲ�", fontproperties = font_big)
340
341 axScatter.grid(True)
342 axHistx.grid(True)
343 axHisty.grid(True)
344 c = Cursor(axScatter, useblit=True, color='red', linewidth=1, vertOn = True, horizOn = True)
345 return [axScatter, axHistx, axHisty], [c]
346
347
348def plot_compare(exit_profits, entry_bests, entry_worsts, entry_nbar_bests, entry_nbar_worsts,

Callers 1

scatter_analyzeFunction · 0.85

Calls 3

intFunction · 0.50
axesMethod · 0.45
plotMethod · 0.45

Tested by

no test coverage detected