@@ -126,11 +126,14 @@ def _check_visible(self, collections, visible=True):
126
126
127
127
Parameters
128
128
----------
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
131
131
visible : bool
132
132
expected visibility
133
133
"""
134
+ from matplotlib .collections import Collection
135
+ if not isinstance (collections , Collection ) and not com .is_list_like (collections ):
136
+ collections = [collections ]
134
137
135
138
for patch in collections :
136
139
self .assertEqual (patch .get_visible (), visible )
@@ -861,9 +864,12 @@ def test_plot(self):
861
864
axes = _check_plot_works (df .plot , subplots = True , title = 'blah' )
862
865
self ._check_axes_shape (axes , axes_num = 3 , layout = (3 , 1 ))
863
866
for ax in axes [:2 ]:
867
+ self ._check_visible (ax .xaxis ) # xaxis must be visible for grid
864
868
self ._check_visible (ax .get_xticklabels (), visible = False )
869
+ self ._check_visible (ax .get_xticklabels (minor = True ), visible = False )
865
870
self ._check_visible ([ax .xaxis .get_label ()], visible = False )
866
871
for ax in [axes [2 ]]:
872
+ self ._check_visible (ax .xaxis )
867
873
self ._check_visible (ax .get_xticklabels ())
868
874
self ._check_visible ([ax .xaxis .get_label ()])
869
875
@@ -1017,21 +1023,61 @@ def test_subplots(self):
1017
1023
self ._check_legend_labels (ax , labels = [com .pprint_thing (column )])
1018
1024
1019
1025
for ax in axes [:- 2 ]:
1026
+ self ._check_visible (ax .xaxis ) # xaxis must be visible for grid
1020
1027
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 )
1021
1030
self ._check_visible (ax .get_yticklabels ())
1022
1031
1032
+ self ._check_visible (axes [- 1 ].xaxis )
1023
1033
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 ())
1024
1036
self ._check_visible (axes [- 1 ].get_yticklabels ())
1025
1037
1026
1038
axes = df .plot (kind = kind , subplots = True , sharex = False )
1027
1039
for ax in axes :
1040
+ self ._check_visible (ax .xaxis )
1028
1041
self ._check_visible (ax .get_xticklabels ())
1042
+ self ._check_visible (ax .get_xticklabels (minor = True ))
1043
+ self ._check_visible (ax .xaxis .get_label ())
1029
1044
self ._check_visible (ax .get_yticklabels ())
1030
1045
1031
1046
axes = df .plot (kind = kind , subplots = True , legend = False )
1032
1047
for ax in axes :
1033
1048
self .assertTrue (ax .get_legend () is None )
1034
1049
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
+
1035
1081
def test_negative_log (self ):
1036
1082
df = - DataFrame (rand (6 , 4 ),
1037
1083
index = list (string .ascii_letters [:6 ]),
0 commit comments