@@ -271,7 +271,6 @@ def test_invalid_logscale(self, input_param):
271
271
df .plot (** {input_param : "sm" })
272
272
273
273
def test_xcompat (self ):
274
- import pandas as pd
275
274
276
275
df = self .tdf
277
276
ax = df .plot (x_compat = True )
@@ -280,14 +279,14 @@ def test_xcompat(self):
280
279
self ._check_ticks_props (ax , xrot = 30 )
281
280
282
281
tm .close ()
283
- pd . plotting .plot_params ["xaxis.compat" ] = True
282
+ plotting .plot_params ["xaxis.compat" ] = True
284
283
ax = df .plot ()
285
284
lines = ax .get_lines ()
286
285
assert not isinstance (lines [0 ].get_xdata (), PeriodIndex )
287
286
self ._check_ticks_props (ax , xrot = 30 )
288
287
289
288
tm .close ()
290
- pd . plotting .plot_params ["x_compat" ] = False
289
+ plotting .plot_params ["x_compat" ] = False
291
290
292
291
ax = df .plot ()
293
292
lines = ax .get_lines ()
@@ -296,7 +295,7 @@ def test_xcompat(self):
296
295
297
296
tm .close ()
298
297
# useful if you're plotting a bunch together
299
- with pd . plotting .plot_params .use ("x_compat" , True ):
298
+ with plotting .plot_params .use ("x_compat" , True ):
300
299
ax = df .plot ()
301
300
lines = ax .get_lines ()
302
301
assert not isinstance (lines [0 ].get_xdata (), PeriodIndex )
@@ -682,15 +681,15 @@ def test_plot_scatter(self):
682
681
def test_raise_error_on_datetime_time_data (self ):
683
682
# GH 8113, datetime.time type is not supported by matplotlib in scatter
684
683
df = DataFrame (np .random .randn (10 ), columns = ["a" ])
685
- df ["dtime" ] = pd . date_range (start = "2014-01-01" , freq = "h" , periods = 10 ).time
684
+ df ["dtime" ] = date_range (start = "2014-01-01" , freq = "h" , periods = 10 ).time
686
685
msg = "must be a string or a number, not 'datetime.time'"
687
686
688
687
with pytest .raises (TypeError , match = msg ):
689
688
df .plot (kind = "scatter" , x = "dtime" , y = "a" )
690
689
691
690
def test_scatterplot_datetime_data (self ):
692
691
# GH 30391
693
- dates = pd . date_range (start = date (2019 , 1 , 1 ), periods = 12 , freq = "W" )
692
+ dates = date_range (start = date (2019 , 1 , 1 ), periods = 12 , freq = "W" )
694
693
vals = np .random .normal (0 , 1 , len (dates ))
695
694
df = DataFrame ({"dates" : dates , "vals" : vals })
696
695
@@ -2095,7 +2094,7 @@ def test_x_string_values_ticks(self):
2095
2094
def test_x_multiindex_values_ticks (self ):
2096
2095
# Test if multiindex plot index have a fixed xtick position
2097
2096
# GH: 15912
2098
- index = pd . MultiIndex .from_product ([[2012 , 2013 ], [1 , 2 ]])
2097
+ index = MultiIndex .from_product ([[2012 , 2013 ], [1 , 2 ]])
2099
2098
df = DataFrame (np .random .randn (4 , 2 ), columns = ["A" , "B" ], index = index )
2100
2099
ax = df .plot ()
2101
2100
ax .set_xlim (- 1 , 4 )
0 commit comments