@@ -26,6 +26,43 @@ def _get_standard_kind(kind):
26
26
return {'density' : 'kde' }.get (kind , kind )
27
27
28
28
29
+ class _Options (dict ):
30
+
31
+ #alias so the names are same as plotting method parameter names
32
+ _ALIASES = {'x_compat' : 'xaxis.compat' }
33
+ _DEFAULT_KEYS = ['xaxis.compat' ]
34
+
35
+ def __init__ (self ):
36
+ self ['xaxis.compat' ] = False
37
+
38
+ def __getitem__ (self , key ):
39
+ key = self ._get_canonical_key (key )
40
+ if key not in self :
41
+ raise ValueError ('%s is not a valid pandas plotting option' % key )
42
+ return super (_Options , self ).__getitem__ (key )
43
+
44
+ def __setitem__ (self , key , value ):
45
+ key = self ._get_canonical_key (key )
46
+ return super (_Options , self ).__setitem__ (key , value )
47
+
48
+ def __delitem__ (self , key ):
49
+ key = self ._get_canonical_key (key )
50
+ if key in self ._DEFAULT_KEYS :
51
+ raise ValueError ('Cannot remove default parameter %s' % key )
52
+ return super (_Options , self ).__delitem__ (key )
53
+
54
+ def __contains__ (self , key ):
55
+ key = self ._get_canonical_key (key )
56
+ return super (_Options , self ).__contains__ (key )
57
+
58
+ def reset (self ):
59
+ self .__init__ ()
60
+
61
+ def _get_canonical_key (self , key ):
62
+ return self ._ALIASES .get (key , key )
63
+
64
+ plot_params = _Options ()
65
+
29
66
def scatter_matrix (frame , alpha = 0.5 , figsize = None , ax = None , grid = False ,
30
67
diagonal = 'hist' , marker = '.' , ** kwds ):
31
68
"""
@@ -875,6 +912,9 @@ class LinePlot(MPLPlot):
875
912
def __init__ (self , data , ** kwargs ):
876
913
self .mark_right = kwargs .pop ('mark_right' , True )
877
914
MPLPlot .__init__ (self , data , ** kwargs )
915
+ self .x_compat = plot_params ['x_compat' ]
916
+ if 'x_compat' in self .kwds :
917
+ self .x_compat = bool (self .kwds .pop ('x_compat' ))
878
918
879
919
def _index_freq (self ):
880
920
from pandas .core .frame import DataFrame
@@ -923,7 +963,7 @@ def _maybe_add_color(self, colors, kwds, style, i):
923
963
def _make_plot (self ):
924
964
import pandas .tseries .plotting as tsplot
925
965
# this is slightly deceptive
926
- if self .use_index and self ._use_dynamic_x ():
966
+ if not self . x_compat and self .use_index and self ._use_dynamic_x ():
927
967
data = self ._maybe_convert_index (self .data )
928
968
self ._make_ts_plot (data , ** self .kwds )
929
969
else :
0 commit comments