@@ -53,17 +53,25 @@ def test_plot(self):
53
53
54
54
df = self .tdf
55
55
_check_plot_works (df .plot , grid = False )
56
- # _check_plot_works adds an ax so catch warning. see GH #13188
57
- with tm . assert_produces_warning ( UserWarning ):
58
- axes = _check_plot_works (df .plot , subplots = True )
56
+
57
+ # _check_plot_works adds an ax so use default_axes=True to avoid warning
58
+ axes = _check_plot_works (df .plot , default_axes = True , subplots = True )
59
59
self ._check_axes_shape (axes , axes_num = 4 , layout = (4 , 1 ))
60
60
61
- with tm .assert_produces_warning (UserWarning ):
62
- axes = _check_plot_works (df .plot , subplots = True , layout = (- 1 , 2 ))
61
+ axes = _check_plot_works (
62
+ df .plot ,
63
+ default_axes = True ,
64
+ subplots = True ,
65
+ layout = (- 1 , 2 ),
66
+ )
63
67
self ._check_axes_shape (axes , axes_num = 4 , layout = (2 , 2 ))
64
68
65
- with tm .assert_produces_warning (UserWarning ):
66
- axes = _check_plot_works (df .plot , subplots = True , use_index = False )
69
+ axes = _check_plot_works (
70
+ df .plot ,
71
+ default_axes = True ,
72
+ subplots = True ,
73
+ use_index = False ,
74
+ )
67
75
self ._check_ticks_props (axes , xrot = 0 )
68
76
self ._check_axes_shape (axes , axes_num = 4 , layout = (4 , 1 ))
69
77
@@ -84,8 +92,7 @@ def test_plot(self):
84
92
_check_plot_works (df .plot , xticks = [1 , 5 , 10 ])
85
93
_check_plot_works (df .plot , ylim = (- 100 , 100 ), xlim = (- 100 , 100 ))
86
94
87
- with tm .assert_produces_warning (UserWarning ):
88
- _check_plot_works (df .plot , subplots = True , title = "blah" )
95
+ _check_plot_works (df .plot , default_axes = True , subplots = True , title = "blah" )
89
96
90
97
# We have to redo it here because _check_plot_works does two plots,
91
98
# once without an ax kwarg and once with an ax kwarg and the new sharex
@@ -1405,9 +1412,7 @@ def test_plot_bar(self):
1405
1412
1406
1413
_check_plot_works (df .plot .bar )
1407
1414
_check_plot_works (df .plot .bar , legend = False )
1408
- # _check_plot_works adds an ax so catch warning. see GH #13188
1409
- with tm .assert_produces_warning (UserWarning ):
1410
- _check_plot_works (df .plot .bar , subplots = True )
1415
+ _check_plot_works (df .plot .bar , default_axes = True , subplots = True )
1411
1416
_check_plot_works (df .plot .bar , stacked = True )
1412
1417
1413
1418
df = DataFrame (
@@ -1629,9 +1634,13 @@ def test_boxplot_vertical(self):
1629
1634
self ._check_text_labels (ax .get_yticklabels (), labels )
1630
1635
assert len (ax .lines ) == self .bp_n_objects * len (numeric_cols )
1631
1636
1632
- # _check_plot_works adds an ax so catch warning. see GH #13188
1633
- with tm .assert_produces_warning (UserWarning ):
1634
- axes = _check_plot_works (df .plot .box , subplots = True , vert = False , logx = True )
1637
+ axes = _check_plot_works (
1638
+ df .plot .box ,
1639
+ default_axes = True ,
1640
+ subplots = True ,
1641
+ vert = False ,
1642
+ logx = True ,
1643
+ )
1635
1644
self ._check_axes_shape (axes , axes_num = 3 , layout = (1 , 3 ))
1636
1645
self ._check_ax_scales (axes , xaxis = "log" )
1637
1646
for ax , label in zip (axes , labels ):
@@ -1698,8 +1707,12 @@ def test_kde_df(self):
1698
1707
ax = df .plot (kind = "kde" , rot = 20 , fontsize = 5 )
1699
1708
self ._check_ticks_props (ax , xrot = 20 , xlabelsize = 5 , ylabelsize = 5 )
1700
1709
1701
- with tm .assert_produces_warning (UserWarning ):
1702
- axes = _check_plot_works (df .plot , kind = "kde" , subplots = True )
1710
+ axes = _check_plot_works (
1711
+ df .plot ,
1712
+ default_axes = True ,
1713
+ kind = "kde" ,
1714
+ subplots = True ,
1715
+ )
1703
1716
self ._check_axes_shape (axes , axes_num = 4 , layout = (4 , 1 ))
1704
1717
1705
1718
axes = df .plot (kind = "kde" , logy = True , subplots = True )
@@ -1723,8 +1736,12 @@ def test_hist_df(self):
1723
1736
expected = [pprint_thing (c ) for c in df .columns ]
1724
1737
self ._check_legend_labels (ax , labels = expected )
1725
1738
1726
- with tm .assert_produces_warning (UserWarning ):
1727
- axes = _check_plot_works (df .plot .hist , subplots = True , logy = True )
1739
+ axes = _check_plot_works (
1740
+ df .plot .hist ,
1741
+ default_axes = True ,
1742
+ subplots = True ,
1743
+ logy = True ,
1744
+ )
1728
1745
self ._check_axes_shape (axes , axes_num = 4 , layout = (4 , 1 ))
1729
1746
self ._check_ax_scales (axes , yaxis = "log" )
1730
1747
@@ -2624,9 +2641,11 @@ def test_pie_df(self):
2624
2641
ax = _check_plot_works (df .plot .pie , y = 2 )
2625
2642
self ._check_text_labels (ax .texts , df .index )
2626
2643
2627
- # _check_plot_works adds an ax so catch warning. see GH #13188
2628
- with tm .assert_produces_warning (UserWarning ):
2629
- axes = _check_plot_works (df .plot .pie , subplots = True )
2644
+ axes = _check_plot_works (
2645
+ df .plot .pie ,
2646
+ default_axes = True ,
2647
+ subplots = True ,
2648
+ )
2630
2649
assert len (axes ) == len (df .columns )
2631
2650
for ax in axes :
2632
2651
self ._check_text_labels (ax .texts , df .index )
@@ -2635,10 +2654,13 @@ def test_pie_df(self):
2635
2654
2636
2655
labels = ["A" , "B" , "C" , "D" , "E" ]
2637
2656
color_args = ["r" , "g" , "b" , "c" , "m" ]
2638
- with tm .assert_produces_warning (UserWarning ):
2639
- axes = _check_plot_works (
2640
- df .plot .pie , subplots = True , labels = labels , colors = color_args
2641
- )
2657
+ axes = _check_plot_works (
2658
+ df .plot .pie ,
2659
+ default_axes = True ,
2660
+ subplots = True ,
2661
+ labels = labels ,
2662
+ colors = color_args ,
2663
+ )
2642
2664
assert len (axes ) == len (df .columns )
2643
2665
2644
2666
for ax in axes :
@@ -2745,16 +2767,15 @@ def test_errorbar_plot_different_kinds(self, kind):
2745
2767
ax = _check_plot_works (df .plot , xerr = 0.2 , yerr = 0.2 , kind = kind )
2746
2768
self ._check_has_errorbars (ax , xerr = 2 , yerr = 2 )
2747
2769
2748
- msg = (
2749
- "To output multiple subplots, "
2750
- "the figure containing the passed axes is being cleared"
2770
+ axes = _check_plot_works (
2771
+ df .plot ,
2772
+ default_axes = True ,
2773
+ yerr = df_err ,
2774
+ xerr = df_err ,
2775
+ subplots = True ,
2776
+ kind = kind ,
2751
2777
)
2752
- with tm .assert_produces_warning (UserWarning , match = msg ):
2753
- # Similar warnings were observed in GH #13188
2754
- axes = _check_plot_works (
2755
- df .plot , yerr = df_err , xerr = df_err , subplots = True , kind = kind
2756
- )
2757
- self ._check_has_errorbars (axes , xerr = 1 , yerr = 1 )
2778
+ self ._check_has_errorbars (axes , xerr = 1 , yerr = 1 )
2758
2779
2759
2780
@pytest .mark .xfail (reason = "Iterator is consumed" , raises = ValueError )
2760
2781
@pytest .mark .slow
@@ -2826,14 +2847,14 @@ def test_errorbar_timeseries(self, kind):
2826
2847
ax = _check_plot_works (tdf .plot , yerr = tdf_err , kind = kind )
2827
2848
self ._check_has_errorbars (ax , xerr = 0 , yerr = 2 )
2828
2849
2829
- msg = (
2830
- "To output multiple subplots, "
2831
- "the figure containing the passed axes is being cleared"
2850
+ axes = _check_plot_works (
2851
+ tdf .plot ,
2852
+ default_axes = True ,
2853
+ kind = kind ,
2854
+ yerr = tdf_err ,
2855
+ subplots = True ,
2832
2856
)
2833
- with tm .assert_produces_warning (UserWarning , match = msg ):
2834
- # Similar warnings were observed in GH #13188
2835
- axes = _check_plot_works (tdf .plot , kind = kind , yerr = tdf_err , subplots = True )
2836
- self ._check_has_errorbars (axes , xerr = 0 , yerr = 1 )
2857
+ self ._check_has_errorbars (axes , xerr = 0 , yerr = 1 )
2837
2858
2838
2859
def test_errorbar_asymmetrical (self ):
2839
2860
np .random .seed (0 )
0 commit comments