@@ -1985,15 +1985,16 @@ def fill_between(self, x1, y1, z1, x2, y2, z2, *,
1985
1985
the *True* position remain unfilled due to the adjacent *False*
1986
1986
values.
1987
1987
1988
- mode : {'auto', 'quad', 'polygon'}, default: 'auto'
1989
- The fill mode, where 'auto' maps to 'quad'.
1990
- If 'quad', then a separate quadrilateral polygon is created for
1991
- each pair of subsequent points in the 1st and 2nd lines. This is
1992
- more flexible, but may be slower and result in rendering artifacts.
1993
- If 'polygon', then the 1st and 2nd lines are connected to form a single
1994
- polygon, which may be faster and render more cleanly for simple
1995
- shapes (eg, for filling between two lines that lie on a single
1996
- plane).
1988
+ mode : {'quad', 'polygon', 'auto'}, default: 'auto'
1989
+ The fill mode. One of:
1990
+ - 'quad': A separate quadrilateral polygon is created for each
1991
+ pair of subsequent points in the two lines.
1992
+ - 'polygon': The two lines are connected to form a single polygon.
1993
+ This is faster and can render more cleanly for simple shapes
1994
+ (e.g. for filling between two lines that lie within a plane).
1995
+ - 'auto': If the lines are in a plane parallel to a coordinate axis
1996
+ (one of *x*, *y*, *z* for both lines are constant and equal),
1997
+ 'polygon' is used. Otherwise, 'quad' is used.
1997
1998
1998
1999
**kwargs
1999
2000
All other keyword arguments are passed on to `.Poly3DCollection`.
@@ -2005,11 +2006,16 @@ def fill_between(self, x1, y1, z1, x2, y2, z2, *,
2005
2006
2006
2007
"""
2007
2008
_api .check_in_list (['auto' , 'quad' , 'polygon' ], mode = mode )
2008
- if mode == 'auto' :
2009
- mode = 'quad'
2010
2009
2011
2010
had_data = self .has_data ()
2012
2011
x1 , y1 , z1 , x2 , y2 , z2 = cbook ._broadcast_with_masks (x1 , y1 , z1 , x2 , y2 , z2 )
2012
+ if mode == 'auto' :
2013
+ if ((np .all (x1 == x1 [0 ]) and np .all (x2 == x1 [0 ]))
2014
+ or (np .all (y1 == y1 [0 ]) and np .all (y2 == y1 [0 ]))
2015
+ or (np .all (z1 == z1 [0 ]) and np .all (z2 == z1 [0 ]))):
2016
+ mode = 'polygon'
2017
+ else :
2018
+ mode = 'quad'
2013
2019
2014
2020
if where is None :
2015
2021
where = True
0 commit comments