Skip to content

Commit d696555

Browse files
committed
Fixed bug involving labels not being compared for image comparisons by lowering tolerance to 8
1 parent fef7735 commit d696555

4 files changed

Lines changed: 93 additions & 93 deletions

File tree

nbs/tests/mpl_image_tests/test_03_plotting.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -132,62 +132,62 @@ def create_demo_dataset(seed=9999, N=20):
132132
)
133133

134134

135-
@pytest.mark.mpl_image_compare(tolerance=10)
135+
@pytest.mark.mpl_image_compare(tolerance=8)
136136
def test_01_gardner_altman_unpaired_meandiff():
137137
return two_groups_unpaired.mean_diff.plot()
138138

139139

140-
@pytest.mark.mpl_image_compare(tolerance=10)
140+
@pytest.mark.mpl_image_compare(tolerance=8)
141141
def test_02_gardner_altman_unpaired_mediandiff():
142142
return two_groups_unpaired.median_diff.plot()
143143

144144

145-
@pytest.mark.mpl_image_compare(tolerance=10)
145+
@pytest.mark.mpl_image_compare(tolerance=8)
146146
def test_03_gardner_altman_unpaired_hedges_g():
147147
return two_groups_unpaired.hedges_g.plot()
148148

149149

150-
@pytest.mark.mpl_image_compare(tolerance=10)
150+
@pytest.mark.mpl_image_compare(tolerance=8)
151151
def test_04_gardner_altman_paired_meandiff():
152152
return two_groups_paired.mean_diff.plot()
153153

154154

155-
@pytest.mark.mpl_image_compare(tolerance=10)
155+
@pytest.mark.mpl_image_compare(tolerance=8)
156156
def test_04_gardner_altman_paired_hedges_g():
157157
return two_groups_paired.hedges_g.plot()
158158

159159

160-
@pytest.mark.mpl_image_compare(tolerance=10)
160+
@pytest.mark.mpl_image_compare(tolerance=8)
161161
def test_05_cummings_two_group_unpaired_meandiff():
162162
return two_groups_unpaired.mean_diff.plot(fig_size=(4, 6), float_contrast=False)
163163

164164

165-
@pytest.mark.mpl_image_compare(tolerance=10)
165+
@pytest.mark.mpl_image_compare(tolerance=8)
166166
def test_06_cummings_two_group_paired_meandiff():
167167
return two_groups_paired.mean_diff.plot(fig_size=(6, 6), float_contrast=False)
168168

169169

170-
@pytest.mark.mpl_image_compare(tolerance=10)
170+
@pytest.mark.mpl_image_compare(tolerance=8)
171171
def test_07_cummings_multi_group_unpaired():
172172
return multi_2group.mean_diff.plot()
173173

174174

175-
@pytest.mark.mpl_image_compare(tolerance=10)
175+
@pytest.mark.mpl_image_compare(tolerance=8)
176176
def test_08_cummings_multi_group_paired():
177177
return multi_2group_paired.mean_diff.plot(fig_size=(6, 6))
178178

179179

180-
@pytest.mark.mpl_image_compare(tolerance=10)
180+
@pytest.mark.mpl_image_compare(tolerance=8)
181181
def test_09_cummings_shared_control():
182182
return shared_control.mean_diff.plot()
183183

184184

185-
@pytest.mark.mpl_image_compare(tolerance=10)
185+
@pytest.mark.mpl_image_compare(tolerance=8)
186186
def test_10_cummings_multi_groups():
187187
return multi_groups.mean_diff.plot()
188188

189189

190-
@pytest.mark.mpl_image_compare(tolerance=10)
190+
@pytest.mark.mpl_image_compare(tolerance=8)
191191
def test_11_inset_plots():
192192
# Load the iris dataset.
193193
try:
@@ -242,31 +242,31 @@ def test_11_inset_plots():
242242
return fig
243243

244244

245-
@pytest.mark.mpl_image_compare(tolerance=10)
245+
@pytest.mark.mpl_image_compare(tolerance=8)
246246
def test_12_gardner_altman_ylabel():
247247
return two_groups_unpaired.mean_diff.plot(
248248
swarm_label="This is my\nrawdata", contrast_label="The bootstrap\ndistribtions!"
249249
)
250250

251251

252-
@pytest.mark.mpl_image_compare(tolerance=10)
252+
@pytest.mark.mpl_image_compare(tolerance=8)
253253
def test_13_multi_2group_color():
254254
return multi_2group.mean_diff.plot(color_col="Gender")
255255

256256

257-
@pytest.mark.mpl_image_compare(tolerance=10)
257+
@pytest.mark.mpl_image_compare(tolerance=8)
258258
def test_14_gardner_altman_paired_color():
259259
return two_groups_paired.mean_diff.plot(fig_size=(6, 6), color_col="Gender")
260260

261261

262-
@pytest.mark.mpl_image_compare(tolerance=10)
262+
@pytest.mark.mpl_image_compare(tolerance=8)
263263
def test_15_change_palette_a():
264264
return multi_2group.mean_diff.plot(
265265
fig_size=(8, 6), color_col="Gender", custom_palette="Dark2"
266266
)
267267

268268

269-
@pytest.mark.mpl_image_compare(tolerance=10)
269+
@pytest.mark.mpl_image_compare(tolerance=8)
270270
def test_16_change_palette_b():
271271
return multi_2group.mean_diff.plot(custom_palette="Paired")
272272

@@ -279,36 +279,36 @@ def test_16_change_palette_b():
279279
}
280280

281281

282-
@pytest.mark.mpl_image_compare(tolerance=10)
282+
@pytest.mark.mpl_image_compare(tolerance=8)
283283
def test_17_change_palette_c():
284284
return multi_2group.mean_diff.plot(custom_palette=my_color_palette)
285285

286286

287-
@pytest.mark.mpl_image_compare(tolerance=10)
287+
@pytest.mark.mpl_image_compare(tolerance=8)
288288
def test_18_desat():
289289
return multi_2group.mean_diff.plot(
290290
custom_palette=my_color_palette, swarm_desat=0.75, halfviolin_desat=0.25
291291
)
292292

293293

294-
@pytest.mark.mpl_image_compare(tolerance=10)
294+
@pytest.mark.mpl_image_compare(tolerance=8)
295295
def test_19_dot_sizes():
296296
return multi_2group.mean_diff.plot(raw_marker_size=3, es_marker_size=12)
297297

298298

299-
@pytest.mark.mpl_image_compare(tolerance=10)
299+
@pytest.mark.mpl_image_compare(tolerance=8)
300300
def test_20_change_ylims():
301301
return multi_2group.mean_diff.plot(swarm_ylim=(0, 5), contrast_ylim=(-2, 2))
302302

303303

304-
@pytest.mark.mpl_image_compare(tolerance=10)
304+
@pytest.mark.mpl_image_compare(tolerance=8)
305305
def test_21_invert_ylim():
306306
return multi_2group.mean_diff.plot(
307307
contrast_ylim=(2, -2), contrast_label="More negative is better!"
308308
)
309309

310310

311-
@pytest.mark.mpl_image_compare(tolerance=10)
311+
@pytest.mark.mpl_image_compare(tolerance=8)
312312
def test_22_ticker_gardner_altman():
313313
f = two_groups_unpaired.mean_diff.plot()
314314

@@ -324,7 +324,7 @@ def test_22_ticker_gardner_altman():
324324
return f
325325

326326

327-
@pytest.mark.mpl_image_compare(tolerance=10)
327+
@pytest.mark.mpl_image_compare(tolerance=8)
328328
def test_23_ticker_cumming():
329329
f = multi_2group.mean_diff.plot(swarm_ylim=(0, 6), contrast_ylim=(-3, 1))
330330

@@ -358,14 +358,14 @@ def test_23_ticker_cumming():
358358
long_df["dummy"] = np.repeat(np.nan, len(long_df))
359359

360360

361-
@pytest.mark.mpl_image_compare(tolerance=10)
361+
@pytest.mark.mpl_image_compare(tolerance=8)
362362
def test_24_wide_df_nan():
363363
wide_df_dabest = load(wide_df, idx=("Control", "Test 1", "Test 2", "Test 3"))
364364

365365
return wide_df_dabest.mean_diff.plot()
366366

367367

368-
@pytest.mark.mpl_image_compare(tolerance=10)
368+
@pytest.mark.mpl_image_compare(tolerance=8)
369369
def test_25_long_df_nan():
370370
long_df_dabest = load(
371371
long_df, x="group", y="value", idx=("Control", "Test 1", "Test 2", "Test 3")
@@ -374,17 +374,17 @@ def test_25_long_df_nan():
374374
return long_df_dabest.mean_diff.plot()
375375

376376

377-
@pytest.mark.mpl_image_compare(tolerance=10)
377+
@pytest.mark.mpl_image_compare(tolerance=8)
378378
def test_26_slopegraph_kwargs():
379379
return two_groups_paired.mean_diff.plot(slopegraph_kwargs=dict(linestyle="dotted"))
380380

381381

382-
@pytest.mark.mpl_image_compare(tolerance=10)
382+
@pytest.mark.mpl_image_compare(tolerance=8)
383383
def test_27_gardner_altman_reflines_kwargs():
384384
return two_groups_unpaired.mean_diff.plot(reflines_kwargs=dict(linestyle="dotted"))
385385

386386

387-
@pytest.mark.mpl_image_compare(tolerance=10)
387+
@pytest.mark.mpl_image_compare(tolerance=8)
388388
def test_28_unpaired_cumming_reflines_kwargs():
389389
return two_groups_unpaired.mean_diff.plot(
390390
fig_size=(12, 10),
@@ -394,7 +394,7 @@ def test_28_unpaired_cumming_reflines_kwargs():
394394
)
395395

396396

397-
@pytest.mark.mpl_image_compare(tolerance=10)
397+
@pytest.mark.mpl_image_compare(tolerance=8)
398398
def test_29_paired_cumming_slopegraph_reflines_kwargs():
399399
return two_groups_paired.mean_diff.plot(
400400
float_contrast=False,
@@ -405,17 +405,17 @@ def test_29_paired_cumming_slopegraph_reflines_kwargs():
405405
)
406406

407407

408-
@pytest.mark.mpl_image_compare(tolerance=10)
408+
@pytest.mark.mpl_image_compare(tolerance=8)
409409
def test_30_sequential_cumming_slopegraph():
410410
return multi_groups_sequential.mean_diff.plot()
411411

412412

413-
@pytest.mark.mpl_image_compare(tolerance=10)
413+
@pytest.mark.mpl_image_compare(tolerance=8)
414414
def test_31_baseline_cumming_slopegraph():
415415
return multi_groups_baseline.mean_diff.plot()
416416

417417

418-
@pytest.mark.mpl_image_compare(tolerance=10)
418+
@pytest.mark.mpl_image_compare(tolerance=8)
419419
def test_99_style_sheets():
420420
# Perform this test last so we don't have to reset the plot style.
421421
plt.style.use("dark_background")

nbs/tests/mpl_image_tests/test_07_delta-delta_plots.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,86 +82,86 @@ def create_demo_dataset_delta(seed=9999, N=20):
8282
paired="sequential", id_col="ID")
8383

8484

85-
@pytest.mark.mpl_image_compare(tolerance=10)
85+
@pytest.mark.mpl_image_compare(tolerance=8)
8686
def test_47_cummings_unpaired_delta_delta_meandiff():
8787
return unpaired.mean_diff.plot();
8888

8989

90-
@pytest.mark.mpl_image_compare(tolerance=10)
90+
@pytest.mark.mpl_image_compare(tolerance=8)
9191
def test_48_cummings_sequential_delta_delta_meandiff():
9292
return sequential.mean_diff.plot();
9393

9494

95-
@pytest.mark.mpl_image_compare(tolerance=10)
95+
@pytest.mark.mpl_image_compare(tolerance=8)
9696
def test_49_cummings_baseline_delta_delta_meandiff():
9797
return baseline.mean_diff.plot();
9898

9999

100-
@pytest.mark.mpl_image_compare(tolerance=10)
100+
@pytest.mark.mpl_image_compare(tolerance=8)
101101
def test_50_delta_plot_ylabel():
102102
return baseline.mean_diff.plot(swarm_label="This is my\nrawdata",
103103
contrast_label="The bootstrap\ndistribtions!",
104104
delta2_label="This is delta!");
105105

106106

107-
@pytest.mark.mpl_image_compare(tolerance=10)
107+
@pytest.mark.mpl_image_compare(tolerance=8)
108108
def test_51_delta_plot_change_palette_a():
109109
return sequential.mean_diff.plot(custom_palette="Dark2");
110110

111111

112-
@pytest.mark.mpl_image_compare(tolerance=10)
112+
@pytest.mark.mpl_image_compare(tolerance=8)
113113
def test_52_delta_specified():
114114
return unpaired_specified.mean_diff.plot();
115115

116116

117-
@pytest.mark.mpl_image_compare(tolerance=10)
117+
@pytest.mark.mpl_image_compare(tolerance=8)
118118
def test_53_delta_change_ylims():
119119
return sequential.mean_diff.plot(swarm_ylim=(0, 9),
120120
contrast_ylim=(-2, 2),
121121
fig_size=(15,6));
122122

123123

124-
@pytest.mark.mpl_image_compare(tolerance=10)
124+
@pytest.mark.mpl_image_compare(tolerance=8)
125125
def test_54_delta_invert_ylim():
126126
return sequential.mean_diff.plot(contrast_ylim=(2, -2),
127127
contrast_label="More negative is better!");
128128

129129

130-
@pytest.mark.mpl_image_compare(tolerance=10)
130+
@pytest.mark.mpl_image_compare(tolerance=8)
131131
def test_55_delta_median_diff():
132132
return sequential.median_diff.plot();
133133

134134

135-
@pytest.mark.mpl_image_compare(tolerance=10)
135+
@pytest.mark.mpl_image_compare(tolerance=8)
136136
def test_56_delta_cohens_d():
137137
return unpaired.cohens_d.plot();
138138

139139

140-
@pytest.mark.mpl_image_compare(tolerance=10)
140+
@pytest.mark.mpl_image_compare(tolerance=8)
141141
def test_57_delta_show_delta2():
142142
return unpaired.mean_diff.plot(show_delta2=False);
143143

144144

145-
@pytest.mark.mpl_image_compare(tolerance=10)
145+
@pytest.mark.mpl_image_compare(tolerance=8)
146146
def test_58_delta_axes_invert_ylim():
147147
return unpaired.mean_diff.plot(delta2_ylim=(2, -2),
148148
delta2_label="More negative is better!");
149149

150150

151-
@pytest.mark.mpl_image_compare(tolerance=10)
151+
@pytest.mark.mpl_image_compare(tolerance=8)
152152
def test_59_delta_axes_invert_ylim_not_showing_delta2():
153153
return unpaired.mean_diff.plot(delta2_ylim=(2, -2),
154154
delta2_label="More negative is better!",
155155
show_delta2=False);
156156

157-
@pytest.mark.mpl_image_compare(tolerance=10)
157+
@pytest.mark.mpl_image_compare(tolerance=8)
158158
def test_71_unpaired_delta_g():
159159
return unpaired.delta_g.plot();
160160

161-
@pytest.mark.mpl_image_compare(tolerance=10)
161+
@pytest.mark.mpl_image_compare(tolerance=8)
162162
def test_72_sequential_delta_g():
163163
return sequential.mean_diff.plot();
164164

165-
@pytest.mark.mpl_image_compare(tolerance=10)
165+
@pytest.mark.mpl_image_compare(tolerance=8)
166166
def test_73_baseline_delta_g():
167167
return baseline.mean_diff.plot();

0 commit comments

Comments
 (0)