#NEWLINE# def get_axes_properties( ax ) : #NEWLINE# #INDENT# props = { #NEWLINE# #INDENT# 'axesbg' : color_to_hex ( ax . patch . get_facecolor ( ) ) , #NEWLINE# 'axesbgalpha' : ax . patch . get_alpha ( ) , #NEWLINE# 'bounds' : ax . get_position ( ) . bounds , #NEWLINE# 'dynamic' : ax . get_navigate ( ) , #NEWLINE# 'axison' : ax . axison , #NEWLINE# 'frame_on' : ax . get_frame_on ( ) , #NEWLINE# 'axes' : [ get_axis_properties ( ax . xaxis ) , get_axis_properties ( ax . yaxis ) ] , #NEWLINE# #UNINDENT# } #NEWLINE# for axname in [ 'x' , 'y' ] : #NEWLINE# #INDENT# axis = getattr ( ax , ( axname + 'axis' ) ) #NEWLINE# domain = getattr ( ax , 'get_{0}lim' . format ( axname ) ) ( ) #NEWLINE# lim = domain #NEWLINE# if isinstance ( axis . converter , matplotlib . dates . DateConverter ) : #NEWLINE# #INDENT# scale = 'date' #NEWLINE# try : #NEWLINE# #INDENT# import pandas as pd #NEWLINE# from pandas.tseries.converter import PeriodConverter #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# pd = None #NEWLINE# #UNINDENT# if ( ( pd is not None ) and isinstance ( axis . converter , PeriodConverter ) ) : #NEWLINE# #INDENT# _dates = [ pd . Period ( ordinal = int ( d ) , freq = axis . freq ) for d in domain ] #NEWLINE# domain = [ ( d . year , ( d . month - 1 ) , d . day , d . hour , d . minute , d . second , 0 ) for d in _dates ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# domain = [ ( d . year , ( d . month - 1 ) , d . day , d . hour , d . minute , d . second , ( d . microsecond * 0.001 ) ) for d in matplotlib . dates . num2date ( domain ) ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# scale = axis . get_scale ( ) #NEWLINE# #UNINDENT# if ( scale not in [ 'date' , 'linear' , 'log' ] ) : #NEWLINE# #INDENT# raise ValueError ( 'Unknown axis scale: {0}' . format ( axis [ axname ] . get_scale ( ) ) ) #NEWLINE# #UNINDENT# props [ ( axname + 'scale' ) ] = scale #NEWLINE# props [ ( axname + 'lim' ) ] = lim #NEWLINE# props [ ( axname + 'domain' ) ] = domain #NEWLINE# #UNINDENT# return props