File tree 1 file changed +22
-0
lines changed 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 24
24
import matplotlib .font_manager as mfont_manager
25
25
import matplotlib .markers as mmarkers
26
26
import matplotlib .patches as mpatches
27
+ import matplotlib .path as mpath
27
28
import matplotlib .pyplot as plt
28
29
import matplotlib .ticker as mticker
29
30
import matplotlib .transforms as mtransforms
@@ -7340,3 +7341,24 @@ def test_clim():
7340
7341
clim = (7 , 8 )
7341
7342
norm = plot_method (clim = clim ).norm
7342
7343
assert (norm .vmin , norm .vmax ) == clim
7344
+
7345
+
7346
+ def test_bezier_autoscale ():
7347
+ # Check that bezier curves autoscale to their curves, and not their
7348
+ # control points
7349
+ verts = [[- 1 , 0 ],
7350
+ [0 , - 1 ],
7351
+ [1 , 0 ],
7352
+ [1 , 0 ]]
7353
+ codes = [mpath .Path .MOVETO ,
7354
+ mpath .Path .CURVE3 ,
7355
+ mpath .Path .CURVE3 ,
7356
+ mpath .Path .CLOSEPOLY ]
7357
+ p = mpath .Path (verts , codes )
7358
+
7359
+ fig , ax = plt .subplots ()
7360
+ ax .add_patch (mpatches .PathPatch (p ))
7361
+ ax .autoscale ()
7362
+ # Bottom ylim should be at the edge of the curve (-0.5), and not include
7363
+ # the control point (at -1)
7364
+ assert ax .get_ylim ()[0 ] == - 0.5
You can’t perform that action at this time.
0 commit comments