def plot_scatter(fig, x, y, x2, y2, binnum):
 fig.canvas.set_window_title(u'\u4ea4\u6613\u9e1f\u77b0\u56fe')
 (left, width) = (0.1, 0.65)
 (bottom, height) = (0.1, 0.65)
 bottom_h = left_h = ((left + width) + 0.02)
 rect_scatter = [left, bottom, width, height]
 rect_histx = [left, bottom_h, width, 0.2]
 rect_histy = [left_h, bottom, 0.2, height]
 axScatter = plt.axes(rect_scatter)
 axHistx = plt.axes(rect_histx)
 axHisty = plt.axes(rect_histy)
 cursor = Cursor(axScatter, useblit=True, color='red', linewidth=1)
 axScatter.plot(x, y, 'o', color='red')
 axScatter.plot(x2, y2, 'o', color='blue')
 xmax = np.max((x + x2))
 xmin = np.min((x + x2))
 binwidth = (xmax / binnum)
 lim = ((int((xmax / binwidth)) + 1) * binwidth)
 bins = np.arange((- lim), (lim + binwidth), binwidth)
 axHistx.hist((x + x2), bins=bins)
 ymax = np.max((y + y2))
 ymin = np.min((y + y2))
 binwidth = (ymax / binnum)
 lim = ((int((ymax / binwidth)) + 1) * binwidth)
 bins = np.arange((- lim), (lim + binwidth), binwidth)
 axHisty.hist(y, bins=bins, orientation='horizontal', color='red')
 axHisty.hist(y2, bins=bins, orientation='horizontal', color='blue')
 xymax = np.max([np.max(np.fabs((x + x2))), np.max(np.fabs((y + y2)))])
 lim = ((int((xymax / binwidth)) + 1) * binwidth)
 axScatter.axhline(color='black')
 axHistx.set_xlim(axScatter.get_xlim())
 axHisty.set_ylim(axScatter.get_ylim())
 axHisty.set_xlabel(u'\u76c8\u4e8f\u5206\u5e03', fontproperties=font_big)
 axHistx.set_ylabel(u'\u5468\u671f\u5206\u5e03', fontproperties=font_big)
 axScatter.set_xlabel(u'\u76c8\u4e8f\u548c\u5468\u671f\u5206\u5e03', fontproperties=font_big)
 axScatter.grid(True)
 axHistx.grid(True)
 axHisty.grid(True)
 c = Cursor(axScatter, useblit=True, color='red', linewidth=1, vertOn=True, horizOn=True)
 return ([axScatter, axHistx, axHisty], [c])

def plot_scatter ( fig , x , y , x2 , y2 , binnum ) : fig . canvas . set_window_title ( u'\u4ea4\u6613\u9e1f\u77b0\u56fe' ) ( left , width ) = ( 0.1 , 0.65 ) ( bottom , height ) = ( 0.1 , 0.65 ) bottom_h = left_h = ( ( left + width ) + 0.02 ) rect_scatter = [ left , bottom , width , height ] rect_histx = [ left , bottom_h , width , 0.2 ] rect_histy = [ left_h , bottom , 0.2 , height ] axScatter = plt . axes ( rect_scatter ) axHistx = plt . axes ( rect_histx ) axHisty = plt . axes ( rect_histy ) cursor = Cursor ( axScatter , useblit = True , color = 'red' , linewidth = 1 ) axScatter . plot ( x , y , 'o' , color = 'red' ) axScatter . plot ( x2 , y2 , 'o' , color = 'blue' ) xmax = np . max ( ( x + x2 ) ) xmin = np . min ( ( x + x2 ) ) binwidth = ( xmax / binnum ) lim = ( ( int ( ( xmax / binwidth ) ) + 1 ) * binwidth ) bins = np . arange ( ( - lim ) , ( lim + binwidth ) , binwidth ) axHistx . hist ( ( x + x2 ) , bins = bins ) ymax = np . max ( ( y + y2 ) ) ymin = np . min ( ( y + y2 ) ) binwidth = ( ymax / binnum ) lim = ( ( int ( ( ymax / binwidth ) ) + 1 ) * binwidth ) bins = np . arange ( ( - lim ) , ( lim + binwidth ) , binwidth ) axHisty . hist ( y , bins = bins , orientation = 'horizontal' , color = 'red' ) axHisty . hist ( y2 , bins = bins , orientation = 'horizontal' , color = 'blue' ) xymax = np . max ( [ np . max ( np . fabs ( ( x + x2 ) ) ) , np . max ( np . fabs ( ( y + y2 ) ) ) ] ) lim = ( ( int ( ( xymax / binwidth ) ) + 1 ) * binwidth ) axScatter . axhline ( color = 'black' ) axHistx . set_xlim ( axScatter . get_xlim ( ) ) axHisty . set_ylim ( axScatter . get_ylim ( ) ) axHisty . set_xlabel ( u'\u76c8\u4e8f\u5206\u5e03' , fontproperties = font_big ) axHistx . set_ylabel ( u'\u5468\u671f\u5206\u5e03' , fontproperties = font_big ) axScatter . set_xlabel ( u'\u76c8\u4e8f\u548c\u5468\u671f\u5206\u5e03' , fontproperties = font_big ) axScatter . grid ( True ) axHistx . grid ( True ) axHisty . grid ( True ) c = Cursor ( axScatter , useblit = True , color = 'red' , linewidth = 1 , vertOn = True , horizOn = True ) return ( [ axScatter , axHistx , axHisty ] , [ c ] )
scatter plot .