@@ -126,11 +126,14 @@ def _check_visible(self, collections, visible=True):
126126
127127 Parameters
128128 ----------
129- collections : list-like
130- list or collection of target artist
129+ collections : matplotlib Artist or its list-like
130+ target Artist or its list or collection
131131 visible : bool
132132 expected visibility
133133 """
134+ from matplotlib .collections import Collection
135+ if not isinstance (collections , Collection ) and not com .is_list_like (collections ):
136+ collections = [collections ]
134137
135138 for patch in collections :
136139 self .assertEqual (patch .get_visible (), visible )
@@ -861,9 +864,12 @@ def test_plot(self):
861864 axes = _check_plot_works (df .plot , subplots = True , title = 'blah' )
862865 self ._check_axes_shape (axes , axes_num = 3 , layout = (3 , 1 ))
863866 for ax in axes [:2 ]:
867+ self ._check_visible (ax .xaxis ) # xaxis must be visible for grid
864868 self ._check_visible (ax .get_xticklabels (), visible = False )
869+ self ._check_visible (ax .get_xticklabels (minor = True ), visible = False )
865870 self ._check_visible ([ax .xaxis .get_label ()], visible = False )
866871 for ax in [axes [2 ]]:
872+ self ._check_visible (ax .xaxis )
867873 self ._check_visible (ax .get_xticklabels ())
868874 self ._check_visible ([ax .xaxis .get_label ()])
869875
@@ -1017,21 +1023,61 @@ def test_subplots(self):
10171023 self ._check_legend_labels (ax , labels = [com .pprint_thing (column )])
10181024
10191025 for ax in axes [:- 2 ]:
1026+ self ._check_visible (ax .xaxis ) # xaxis must be visible for grid
10201027 self ._check_visible (ax .get_xticklabels (), visible = False )
1028+ self ._check_visible (ax .get_xticklabels (minor = True ), visible = False )
1029+ self ._check_visible (ax .xaxis .get_label (), visible = False )
10211030 self ._check_visible (ax .get_yticklabels ())
10221031
1032+ self ._check_visible (axes [- 1 ].xaxis )
10231033 self ._check_visible (axes [- 1 ].get_xticklabels ())
1034+ self ._check_visible (axes [- 1 ].get_xticklabels (minor = True ))
1035+ self ._check_visible (axes [- 1 ].xaxis .get_label ())
10241036 self ._check_visible (axes [- 1 ].get_yticklabels ())
10251037
10261038 axes = df .plot (kind = kind , subplots = True , sharex = False )
10271039 for ax in axes :
1040+ self ._check_visible (ax .xaxis )
10281041 self ._check_visible (ax .get_xticklabels ())
1042+ self ._check_visible (ax .get_xticklabels (minor = True ))
1043+ self ._check_visible (ax .xaxis .get_label ())
10291044 self ._check_visible (ax .get_yticklabels ())
10301045
10311046 axes = df .plot (kind = kind , subplots = True , legend = False )
10321047 for ax in axes :
10331048 self .assertTrue (ax .get_legend () is None )
10341049
1050+ @slow
1051+ def test_subplots_timeseries (self ):
1052+ idx = date_range (start = '2014-07-01' , freq = 'M' , periods = 10 )
1053+ df = DataFrame (np .random .rand (10 , 3 ), index = idx )
1054+
1055+ for kind in ['line' , 'area' ]:
1056+ axes = df .plot (kind = kind , subplots = True , sharex = True )
1057+ self ._check_axes_shape (axes , axes_num = 3 , layout = (3 , 1 ))
1058+
1059+ for ax in axes [:- 2 ]:
1060+ # GH 7801
1061+ self ._check_visible (ax .xaxis ) # xaxis must be visible for grid
1062+ self ._check_visible (ax .get_xticklabels (), visible = False )
1063+ self ._check_visible (ax .get_xticklabels (minor = True ), visible = False )
1064+ self ._check_visible (ax .xaxis .get_label (), visible = False )
1065+ self ._check_visible (ax .get_yticklabels ())
1066+
1067+ self ._check_visible (axes [- 1 ].xaxis )
1068+ self ._check_visible (axes [- 1 ].get_xticklabels ())
1069+ self ._check_visible (axes [- 1 ].get_xticklabels (minor = True ))
1070+ self ._check_visible (axes [- 1 ].xaxis .get_label ())
1071+ self ._check_visible (axes [- 1 ].get_yticklabels ())
1072+
1073+ axes = df .plot (kind = kind , subplots = True , sharex = False )
1074+ for ax in axes :
1075+ self ._check_visible (ax .xaxis )
1076+ self ._check_visible (ax .get_xticklabels ())
1077+ self ._check_visible (ax .get_xticklabels (minor = True ))
1078+ self ._check_visible (ax .xaxis .get_label ())
1079+ self ._check_visible (ax .get_yticklabels ())
1080+
10351081 def test_negative_log (self ):
10361082 df = - DataFrame (rand (6 , 4 ),
10371083 index = list (string .ascii_letters [:6 ]),
0 commit comments