1
+ #
1
2
# %%
2
3
3
4
import pytest
10
11
11
12
12
13
# %%
13
- titles_zip = [
14
+ titles_tips = [
14
15
{("Lunch" , "Male" ): "blaa" },
15
16
{("Male" ): "blAA" },
16
17
None ,
17
18
None ,
18
19
]
19
- zipped_tips = dac .add_zip_column (dac .zipped_noempty_tips , titles_zip )
20
+ zipped_tips = dac .add_zip_column (dac .zipped_noempty_tips , titles_tips )
20
21
21
22
22
23
@pytest .mark .parametrize ("DF, dims, axtitles" , zipped_tips )
@@ -56,13 +57,13 @@ def test_edit_titles_with_func(DF, dims):
56
57
ipytest .run ()
57
58
58
59
# %%
59
- titles_zip = [
60
+ titles_tips = [
60
61
["sdfsfd" , None , "dd" , None ],
61
62
[None , "aa" ],
62
63
None ,
63
64
None ,
64
65
]
65
- zipped_tips = dac .add_zip_column (dac .zipped_noempty_tips , titles_zip )
66
+ zipped_tips = dac .add_zip_column (dac .zipped_noempty_tips , titles_tips )
66
67
67
68
68
69
@pytest .mark .parametrize ("DF, dims, titles" , zipped_tips )
@@ -123,7 +124,7 @@ def test_edit_y_ticklabel_percentage(DF, dims):
123
124
DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
124
125
DA .plot ().edit_y_ticklabel_percentage (
125
126
decimals_major = 1 ,
126
- decimals_minor = 1 , # !! Not working
127
+ decimals_minor = 1 , # !! Not working
127
128
)
128
129
if __name__ == "__main__" :
129
130
plt .show ()
@@ -133,3 +134,140 @@ def test_edit_y_ticklabel_percentage(DF, dims):
133
134
134
135
if __name__ == "__main__" :
135
136
ipytest .run ()
137
+
138
+
139
+ # %%
140
+ @pytest .mark .parametrize ("DF, dims" , dac .zipped_ALL )
141
+ def test_edit_y_ticklabels_log_minor (DF , dims ):
142
+ DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
143
+ DA .plot ().edit_y_scale_log (base = 2 ).edit_y_ticklabels_log_minor (
144
+ subs = [2 , 3 , 5 , 7 ],
145
+ )
146
+ if __name__ == "__main__" :
147
+ plt .show ()
148
+ else :
149
+ plt .close ("all" )
150
+
151
+
152
+ if __name__ == "__main__" :
153
+ ipytest .run ()
154
+
155
+
156
+ # %%
157
+ labels_zip = [
158
+ ["sdfsfd" , "dddd" ],
159
+ ["sdfsfd" , "dddd" ],
160
+ ["sdfsfd" , "dddd" ],
161
+ ["sdfsfd" , "dddd" ],
162
+ ]
163
+ zipped_tips = dac .add_zip_column (dac .zipped_noempty_tips , labels_zip )
164
+
165
+
166
+ @pytest .mark .parametrize ("DF, dims, labels" , zipped_tips )
167
+ def test_edit_x_ticklabels_exchange (DF , dims , labels ):
168
+ DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
169
+ DA .plot ().edit_x_ticklabels_exchange (
170
+ labels = labels ,
171
+ labels_lowest_row = [l .upper () for l in labels ],
172
+ )
173
+ if __name__ == "__main__" :
174
+ plt .show ()
175
+ else :
176
+ plt .close ("all" )
177
+
178
+
179
+ if __name__ == "__main__" :
180
+ ipytest .run ()
181
+
182
+
183
+ # %%
184
+ @pytest .mark .parametrize ("DF, dims" , dac .zipped_ALL )
185
+ def test_edit_x_ticklabels_exchange (DF , dims ):
186
+ DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
187
+ DA .plot ().edit_x_ticklabels_rotate (
188
+ rotation = 75 ,
189
+ ha = "center" ,
190
+ # va="top",
191
+ pad = 0.1 ,
192
+ )
193
+ if __name__ == "__main__" :
194
+ plt .show ()
195
+ else :
196
+ plt .close ("all" )
197
+
198
+
199
+ if __name__ == "__main__" :
200
+ ipytest .run ()
201
+
202
+ # %%
203
+ plt .close ("all" )
204
+
205
+
206
+ # %%
207
+ @pytest .mark .parametrize ("DF, dims" , dac .zipped_ALL )
208
+ def test_edit_grid (DF , dims ):
209
+ plt .close ()
210
+ DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
211
+ (
212
+ DA .plot ()
213
+ .edit_y_scale_log (base = 2 ) #' To see minor ticks
214
+ .edit_grid (
215
+ y_major_kws = dict (ls = "--" , linewidth = 0.5 , c = "grey" ),
216
+ y_minor_kws = dict (ls = ":" , linewidth = 0.2 , c = "grey" ),
217
+ x_major_kws = dict (ls = "--" , linewidth = 0.6 , c = "grey" ),
218
+ )
219
+ )
220
+ if __name__ == "__main__" :
221
+ plt .show ()
222
+ else :
223
+ plt .close ("all" )
224
+
225
+
226
+ if __name__ == "__main__" :
227
+ ipytest .run ()
228
+
229
+
230
+ # %%
231
+ @pytest .mark .parametrize ("DF, dims" , dac .zipped_ALL )
232
+ def test_edit_legend (DF , dims ):
233
+ DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
234
+ if DA .dims .hue :
235
+ DA .plot ().edit_legend (
236
+ reset_legend = True ,
237
+ title = "HUI" ,
238
+ loc = "upper right" ,
239
+ bbox_to_anchor = (1.3 , 1 ),
240
+ borderaxespad = 1 ,
241
+ pad = 0.5 ,
242
+ frameon = True ,
243
+ ) #' To see minor ticks
244
+
245
+ if __name__ == "__main__" :
246
+ plt .show ()
247
+ else :
248
+ plt .close ("all" )
249
+
250
+
251
+ if __name__ == "__main__" :
252
+ ipytest .run ()
253
+
254
+
255
+ @pytest .mark .parametrize ("DF, dims" , dac .zipped_ALL )
256
+ def test_edit_fontsizes (DF , dims ):
257
+ plt .close ()
258
+ DA = plst .DataAnalysis (data = DF , dims = dims , verbose = False )
259
+
260
+ DA .plot ().edit_fontsizes (
261
+ ticklabels = 14 ,
262
+ xylabels = 16 ,
263
+ axis_titles = 18 ,
264
+ ) #' To see minor ticks
265
+
266
+ if __name__ == "__main__" :
267
+ plt .show ()
268
+ else :
269
+ plt .close ("all" )
270
+
271
+
272
+ if __name__ == "__main__" :
273
+ ipytest .run ()
0 commit comments