@@ -305,8 +305,67 @@ def test_get_rotation_mod360():
305
305
for i , j in zip ([360. , 377. , 720 + 177.2 ], [0. , 17. , 177.2 ]):
306
306
assert_almost_equal (text .get_rotation (i ), j )
307
307
308
+
308
309
@image_comparison (baseline_images = ['text_bboxclip' ])
309
310
def test_bbox_clipping ():
310
311
plt .text (0.9 , 0.2 , 'Is bbox clipped?' , backgroundcolor = 'r' , clip_on = True )
311
312
t = plt .text (0.9 , 0.5 , 'Is fancy bbox clipped?' , clip_on = True )
312
313
t .set_bbox ({"boxstyle" : "round, pad=0.1" })
314
+
315
+
316
+ @image_comparison (baseline_images = ['annotation_negative_ax_coords' ],
317
+ extensions = ['png' ])
318
+ def test_annotation_negative_ax_coords ():
319
+ fig , ax = plt .subplots ()
320
+
321
+ ax .annotate ('+ pts' ,
322
+ xytext = [30 , 20 ], textcoords = 'axes points' ,
323
+ xy = [30 , 20 ], xycoords = 'axes points' , fontsize = 32 )
324
+ ax .annotate ('- pts' ,
325
+ xytext = [30 , - 20 ], textcoords = 'axes points' ,
326
+ xy = [30 , - 20 ], xycoords = 'axes points' , fontsize = 32 ,
327
+ va = 'top' )
328
+ ax .annotate ('+ frac' ,
329
+ xytext = [0.75 , 0.05 ], textcoords = 'axes fraction' ,
330
+ xy = [0.75 , 0.05 ], xycoords = 'axes fraction' , fontsize = 32 )
331
+ ax .annotate ('- frac' ,
332
+ xytext = [0.75 , - 0.05 ], textcoords = 'axes fraction' ,
333
+ xy = [0.75 , - 0.05 ], xycoords = 'axes fraction' , fontsize = 32 ,
334
+ va = 'top' )
335
+
336
+ ax .annotate ('+ pixels' ,
337
+ xytext = [160 , 25 ], textcoords = 'axes pixels' ,
338
+ xy = [160 , 25 ], xycoords = 'axes pixels' , fontsize = 32 )
339
+ ax .annotate ('- pixels' ,
340
+ xytext = [160 , - 25 ], textcoords = 'axes pixels' ,
341
+ xy = [160 , - 25 ], xycoords = 'axes pixels' , fontsize = 32 ,
342
+ va = 'top' )
343
+
344
+
345
+ @image_comparison (baseline_images = ['annotation_negative_fig_coords' ],
346
+ extensions = ['png' ])
347
+ def test_annotation_negative_fig_coords ():
348
+ fig , ax = plt .subplots ()
349
+
350
+ ax .annotate ('+ pts' ,
351
+ xytext = [10 , 120 ], textcoords = 'figure points' ,
352
+ xy = [10 , 120 ], xycoords = 'figure points' , fontsize = 32 )
353
+ ax .annotate ('- pts' ,
354
+ xytext = [- 10 , 180 ], textcoords = 'figure points' ,
355
+ xy = [- 10 , 180 ], xycoords = 'figure points' , fontsize = 32 ,
356
+ va = 'top' )
357
+ ax .annotate ('+ frac' ,
358
+ xytext = [0.05 , 0.55 ], textcoords = 'figure fraction' ,
359
+ xy = [0.05 , 0.55 ], xycoords = 'figure fraction' , fontsize = 32 )
360
+ ax .annotate ('- frac' ,
361
+ xytext = [- 0.05 , 0.5 ], textcoords = 'figure fraction' ,
362
+ xy = [- 0.05 , 0.5 ], xycoords = 'figure fraction' , fontsize = 32 ,
363
+ va = 'top' )
364
+
365
+ ax .annotate ('+ pixels' ,
366
+ xytext = [50 , 50 ], textcoords = 'figure pixels' ,
367
+ xy = [50 , 50 ], xycoords = 'figure pixels' , fontsize = 32 )
368
+ ax .annotate ('- pixels' ,
369
+ xytext = [- 50 , 100 ], textcoords = 'figure pixels' ,
370
+ xy = [- 50 , 100 ], xycoords = 'figure pixels' , fontsize = 32 ,
371
+ va = 'top' )
0 commit comments