|
15 | 15 | from axis import XAxis, YAxis |
16 | 16 | from cbook import iterable, is_string_like, flatten, enumerate, \ |
17 | 17 | allequal, dict_delall, popd, popall, silent_list, is_numlike |
18 | | -from collections import RegularPolyCollection, PolyCollection, LineCollection, QuadMesh, \ |
19 | | - StarPolygonCollection |
| 18 | +from collections import RegularPolyCollection, PolyCollection, LineCollection, \ |
| 19 | + QuadMesh, StarPolygonCollection, BrokenBarHCollection |
20 | 20 | from colors import colorConverter, normalize, Colormap, \ |
21 | 21 | LinearSegmentedColormap, looks_like_color, is_color_like |
22 | 22 | import cm |
@@ -432,20 +432,28 @@ def _set_lim_and_transforms(self): |
432 | 432 | if self._sharex is not None: |
433 | 433 | left=self._sharex.viewLim.ll().x() |
434 | 434 | right=self._sharex.viewLim.ur().x() |
| 435 | + #dleft=self._sharex.dataLim.ll().x() |
| 436 | + #dright=self._sharex.dataLim.ur().x() |
435 | 437 | else: |
436 | 438 | left=zero() |
437 | 439 | right=one() |
| 440 | + #dleft=zero() |
| 441 | + #dright=one() |
438 | 442 | if self._sharey is not None: |
439 | 443 | bottom=self._sharey.viewLim.ll().y() |
440 | 444 | top=self._sharey.viewLim.ur().y() |
| 445 | + #dbottom=self._sharey.dataLim.ll().y() |
| 446 | + #dtop=self._sharey.dataLim.ur().y() |
441 | 447 | else: |
442 | 448 | bottom=zero() |
443 | 449 | top=one() |
| 450 | + #dbottom=zero() |
| 451 | + #dtop=one() |
444 | 452 |
|
445 | 453 | self.viewLim = Bbox(Point(left, bottom), Point(right, top)) |
| 454 | + #self.dataLim = Bbox(Point(dleft, dbottom), Point(dright, dtop)) |
446 | 455 | self.dataLim = unit_bbox() |
447 | 456 |
|
448 | | - |
449 | 457 | self.transData = get_bbox_transform(self.viewLim, self.bbox) |
450 | 458 | self.transAxes = get_bbox_transform(unit_bbox(), self.bbox) |
451 | 459 |
|
@@ -2626,7 +2634,32 @@ def barh(self, bottom, width, height=0.8, left=0, |
2626 | 2634 | ) |
2627 | 2635 | return patches |
2628 | 2636 |
|
| 2637 | + def broken_barh(self, xranges, yrange, **kwargs): |
| 2638 | + """ |
| 2639 | + A colleciton of horizontal bars spanning yrange with a sequence of |
| 2640 | + xranges |
| 2641 | +
|
| 2642 | + xranges : sequence of (xmin, xwidth) |
| 2643 | + yrange : (ymin, ywidth) |
| 2644 | + |
| 2645 | + optional kwargs: |
| 2646 | + edgecolors |
| 2647 | + facecolors |
| 2648 | + linewidths |
| 2649 | + antialiaseds |
| 2650 | +
|
| 2651 | + these can either be a single argument, ie facecolors='black' |
| 2652 | + or a sequence of arguments for the various bars, ie |
| 2653 | + facecolors='black', 'red', 'green' |
| 2654 | +
|
| 2655 | + """ |
| 2656 | + col = BrokenBarHCollection(xranges, yrange, **kwargs) |
| 2657 | + self.add_collection(col, autolim=True) |
| 2658 | + self.autoscale_view() |
| 2659 | + |
| 2660 | + return col |
2629 | 2661 |
|
| 2662 | + |
2630 | 2663 | def stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-'): |
2631 | 2664 | """ |
2632 | 2665 | STEM(x, y, linefmt='b-', markerfmt='bo', basefmt='r-') |
|
0 commit comments