#NEWLINE# def scale_facet_grid( xdim , ydim , facet_pairs , scaletype ) : #NEWLINE# #INDENT# if ( scaletype is None ) : #NEWLINE# #INDENT# ( min_x , max_x ) = ( 999999999 , ( - 999999999 ) ) #NEWLINE# ( min_y , max_y ) = ( 999999999 , ( - 999999999 ) ) #NEWLINE# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# min_x = min ( min_x , min ( plt . xlim ( ) ) ) #NEWLINE# max_x = max ( max_x , max ( plt . xlim ( ) ) ) #NEWLINE# min_y = min ( min_y , min ( plt . ylim ( ) ) ) #NEWLINE# max_y = max ( max_y , max ( plt . ylim ( ) ) ) #NEWLINE# #UNINDENT# ( y_scale , y_min , y_max ) = calc_axis_breaks_and_limits ( min_y , max_y , 4 ) #NEWLINE# y_scale = np . round ( y_scale , 2 ) #NEWLINE# ( x_scale , x_min , x_max ) = calc_axis_breaks_and_limits ( min_x , max_x , 4 ) #NEWLINE# x_scale = np . round ( x_scale , 2 ) #NEWLINE# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# y_labs = y_scale #NEWLINE# if ( ( pos % ydim ) != 1 ) : #NEWLINE# #INDENT# y_labs = [ ] #NEWLINE# #UNINDENT# plt . yticks ( y_scale , y_labs ) #NEWLINE# plt . ylim ( y_min , y_max ) #NEWLINE# x_labs = x_scale #NEWLINE# if ( pos <= ( len ( facet_pairs ) - ydim ) ) : #NEWLINE# #INDENT# x_labs = [ ] #NEWLINE# #UNINDENT# plt . xticks ( x_scale , x_labs ) #NEWLINE# plt . xlim ( x_min , x_max ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( scaletype == 'free_y' ) : #NEWLINE# #INDENT# ( min_x , max_x ) = ( 999999999 , ( - 999999999 ) ) #NEWLINE# ( min_ys , max_ys ) = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# y_bucket = int ( ( ( pos - 1 ) / ydim ) ) #NEWLINE# min_ys [ y_bucket ] = min_ys . get ( y_bucket , 999999999 ) #NEWLINE# max_ys [ y_bucket ] = max_ys . get ( y_bucket , ( - 999999999 ) ) #NEWLINE# min_x = min ( min_x , min ( plt . xlim ( ) ) ) #NEWLINE# max_x = max ( max_x , max ( plt . xlim ( ) ) ) #NEWLINE# min_ys [ y_bucket ] = min ( min_ys [ y_bucket ] , min ( plt . ylim ( ) ) ) #NEWLINE# max_ys [ y_bucket ] = max ( max_ys [ y_bucket ] , max ( plt . ylim ( ) ) ) #NEWLINE# #UNINDENT# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# y_bucket = int ( ( ( pos - 1 ) / ydim ) ) #NEWLINE# ( y_scale , y_min , y_max ) = calc_axis_breaks_and_limits ( min_ys [ y_bucket ] , max_ys [ y_bucket ] , 4 ) #NEWLINE# y_scale = np . round ( y_scale , 2 ) #NEWLINE# y_labs = y_scale #NEWLINE# if ( ( pos % ydim ) != 1 ) : #NEWLINE# #INDENT# y_labs = [ ] #NEWLINE# #UNINDENT# plt . yticks ( y_scale , y_labs ) #NEWLINE# plt . ylim ( y_min , y_max ) #NEWLINE# ( x_scale , x_min , x_max ) = calc_axis_breaks_and_limits ( min_x , max_x , 4 ) #NEWLINE# x_scale = np . round ( x_scale , 2 ) #NEWLINE# x_labs = x_scale #NEWLINE# if ( pos <= ( len ( facet_pairs ) - ydim ) ) : #NEWLINE# #INDENT# x_labs = [ ] #NEWLINE# #UNINDENT# plt . xticks ( x_scale , x_labs ) #NEWLINE# plt . xlim ( x_min , x_max ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( scaletype == 'free_x' ) : #NEWLINE# #INDENT# ( min_y , max_y ) = ( 999999999 , ( - 999999999 ) ) #NEWLINE# ( min_xs , max_xs ) = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# x_bucket = int ( ( ( pos - 1 ) / xdim ) ) #NEWLINE# min_xs [ x_bucket ] = min_xs . get ( x_bucket , 999999999 ) #NEWLINE# max_xs [ x_bucket ] = max_xs . get ( x_bucket , ( - 999999999 ) ) #NEWLINE# min_y = min ( min_y , min ( plt . ylim ( ) ) ) #NEWLINE# max_y = max ( max_y , max ( plt . ylim ( ) ) ) #NEWLINE# min_xs [ x_bucket ] = min ( min_xs [ x_bucket ] , min ( plt . xlim ( ) ) ) #NEWLINE# max_xs [ x_bucket ] = max ( max_xs [ x_bucket ] , max ( plt . xlim ( ) ) ) #NEWLINE# #UNINDENT# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# x_bucket = int ( ( ( pos - 1 ) / xdim ) ) #NEWLINE# ( x_scale , x_min , x_max ) = calc_axis_breaks_and_limits ( min_xs [ x_bucket ] , max_xs [ x_bucket ] , 4 ) #NEWLINE# x_scale = np . round ( x_scale , 2 ) #NEWLINE# x_labs = x_scale #NEWLINE# if ( pos <= ( len ( facet_pairs ) - ydim ) ) : #NEWLINE# #INDENT# x_labs = [ ] #NEWLINE# #UNINDENT# plt . xticks ( x_scale , x_labs ) #NEWLINE# plt . xlim ( x_min , x_max ) #NEWLINE# ( y_scale , y_min , y_max ) = calc_axis_breaks_and_limits ( min_y , max_y , 4 ) #NEWLINE# y_scale = np . round ( y_scale , 2 ) #NEWLINE# y_labs = y_scale #NEWLINE# if ( ( pos % ydim ) != 1 ) : #NEWLINE# #INDENT# y_labs = [ ] #NEWLINE# #UNINDENT# plt . yticks ( y_scale , y_labs ) #NEWLINE# plt . ylim ( y_min , y_max ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( min_xs , max_xs ) = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# ( min_ys , max_ys ) = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# x_bucket = int ( ( ( pos - 1 ) / xdim ) ) #NEWLINE# min_xs [ x_bucket ] = min_xs . get ( x_bucket , 999999999 ) #NEWLINE# max_xs [ x_bucket ] = max_xs . get ( x_bucket , ( - 999999999 ) ) #NEWLINE# min_xs [ x_bucket ] = min ( min_xs [ x_bucket ] , min ( plt . xlim ( ) ) ) #NEWLINE# max_xs [ x_bucket ] = max ( max_xs [ x_bucket ] , max ( plt . xlim ( ) ) ) #NEWLINE# y_bucket = int ( ( ( pos - 1 ) / ydim ) ) #NEWLINE# min_ys [ y_bucket ] = min_ys . get ( y_bucket , 999999999 ) #NEWLINE# max_ys [ y_bucket ] = max_ys . get ( y_bucket , ( - 999999999 ) ) #NEWLINE# min_ys [ y_bucket ] = min ( min_ys [ y_bucket ] , min ( plt . ylim ( ) ) ) #NEWLINE# max_ys [ y_bucket ] = max ( max_ys [ y_bucket ] , max ( plt . ylim ( ) ) ) #NEWLINE# #UNINDENT# for ( pos , _ ) in enumerate ( facet_pairs ) : #NEWLINE# #INDENT# pos += 1 #NEWLINE# plt . subplot ( xdim , ydim , pos ) #NEWLINE# x_bucket = int ( ( ( pos - 1 ) / xdim ) ) #NEWLINE# ( x_scale , x_min , x_max ) = calc_axis_breaks_and_limits ( min_xs [ x_bucket ] , max_xs [ x_bucket ] , 4 ) #NEWLINE# x_scale = np . round ( x_scale , 2 ) #NEWLINE# x_labs = x_scale #NEWLINE# if ( pos <= ( len ( facet_pairs ) - ydim ) ) : #NEWLINE# #INDENT# x_labs = [ ] #NEWLINE# #UNINDENT# plt . xticks ( x_scale , x_labs ) #NEWLINE# plt . xlim ( x_min , x_max ) #NEWLINE# y_bucket = int ( ( ( pos - 1 ) / ydim ) ) #NEWLINE# ( y_scale , y_min , y_max ) = calc_axis_breaks_and_limits ( min_ys [ y_bucket ] , max_ys [ y_bucket ] , 4 ) #NEWLINE# y_scale = np . round ( y_scale , 2 ) #NEWLINE# y_labs = y_scale #NEWLINE# if ( ( pos % ydim ) != 1 ) : #NEWLINE# #INDENT# y_labs = [ ] #NEWLINE# #UNINDENT# plt . yticks ( y_scale , y_labs ) #NEWLINE# plt . ylim ( y_min , y_max )