Plot a horizontal sequence of rectangles. A rectangle is drawn for each element of *xranges*. All rectangles have the same vertical position and size defined by *yrange*. Parameters ---------- xranges : sequence of tuples (*xmin*, *xwidth*)
(self, xranges, yrange, align="bottom", **kwargs)
| 2971 | @_preprocess_data() |
| 2972 | @_docstring.interpd |
| 2973 | def broken_barh(self, xranges, yrange, align="bottom", **kwargs): |
| 2974 | """ |
| 2975 | Plot a horizontal sequence of rectangles. |
| 2976 | |
| 2977 | A rectangle is drawn for each element of *xranges*. All rectangles |
| 2978 | have the same vertical position and size defined by *yrange*. |
| 2979 | |
| 2980 | Parameters |
| 2981 | ---------- |
| 2982 | xranges : sequence of tuples (*xmin*, *xwidth*) |
| 2983 | The x-positions and extents of the rectangles. For each tuple |
| 2984 | (*xmin*, *xwidth*) a rectangle is drawn from *xmin* to *xmin* + |
| 2985 | *xwidth*. |
| 2986 | yrange : (*ypos*, *yheight*) |
| 2987 | The y-position and extent for all the rectangles. |
| 2988 | align : {"bottom", "center", "top"}, default: 'bottom' |
| 2989 | The alignment of the yrange with respect to the y-position. One of: |
| 2990 | |
| 2991 | - "bottom": Resulting y-range [ypos, ypos + yheight] |
| 2992 | - "center": Resulting y-range [ypos - yheight/2, ypos + yheight/2] |
| 2993 | - "top": Resulting y-range [ypos - yheight, ypos] |
| 2994 | |
| 2995 | .. versionadded:: 3.11 |
| 2996 | |
| 2997 | Returns |
| 2998 | ------- |
| 2999 | `~.collections.PolyCollection` |
| 3000 | |
| 3001 | Other Parameters |
| 3002 | ---------------- |
| 3003 | data : indexable object, optional |
| 3004 | DATA_PARAMETER_PLACEHOLDER |
| 3005 | **kwargs : `.PolyCollection` properties |
| 3006 | |
| 3007 | Each *kwarg* can be either a single argument applying to all |
| 3008 | rectangles, e.g.:: |
| 3009 | |
| 3010 | facecolors='black' |
| 3011 | |
| 3012 | or a sequence of arguments over which is cycled, e.g.:: |
| 3013 | |
| 3014 | facecolors=('black', 'blue') |
| 3015 | |
| 3016 | would create interleaving black and blue rectangles. |
| 3017 | |
| 3018 | Supported keywords: |
| 3019 | |
| 3020 | %(PolyCollection:kwdoc)s |
| 3021 | """ |
| 3022 | # process the unit information |
| 3023 | xdata = cbook._safe_first_finite(xranges) if len(xranges) else None |
| 3024 | ydata = cbook._safe_first_finite(yrange) if len(yrange) else None |
| 3025 | self._process_unit_info( |
| 3026 | [("x", xdata), ("y", ydata)], kwargs, convert=False) |
| 3027 | |
| 3028 | vertices = [] |
| 3029 | ypos, height = yrange |
| 3030 |