|
14 | 14 | import matplotlib.pyplot as plt |
15 | 15 | import matplotlib.collections as mcollections |
16 | 16 | import matplotlib.transforms as mtransforms |
17 | | -from matplotlib.collections import Collection, EventCollection |
| 17 | +from matplotlib.collections import Collection, LineCollection, EventCollection |
18 | 18 | from matplotlib.testing.decorators import image_comparison |
19 | 19 |
|
20 | 20 |
|
@@ -642,6 +642,28 @@ def test_joinstyle(): |
642 | 642 | assert_equal(col.get_joinstyle(), 'miter') |
643 | 643 |
|
644 | 644 |
|
| 645 | +@image_comparison(baseline_images=['cap_and_joinstyle'], |
| 646 | + extensions=['png']) |
| 647 | +def test_cap_and_joinstyle_image(): |
| 648 | + fig = plt.figure() |
| 649 | + ax = fig.add_subplot(1, 1, 1) |
| 650 | + ax.set_xlim([-0.5, 1.5]) |
| 651 | + ax.set_ylim([-0.5, 2.5]) |
| 652 | + |
| 653 | + x = np.array([0.0, 1.0, 0.5]) |
| 654 | + ys = np.array([[0.0], [0.5], [1.0]]) + np.array([[0.0, 0.0, 1.0]]) |
| 655 | + |
| 656 | + segs = np.zeros((3, 3, 2)) |
| 657 | + segs[:, :, 0] = x |
| 658 | + segs[:, :, 1] = ys |
| 659 | + line_segments = LineCollection(segs, linewidth=[10, 15, 20]) |
| 660 | + line_segments.set_capstyle("round") |
| 661 | + line_segments.set_joinstyle("miter") |
| 662 | + |
| 663 | + ax.add_collection(line_segments) |
| 664 | + ax.set_title('Line collection with customized caps and joinstyle') |
| 665 | + |
| 666 | + |
645 | 667 | @image_comparison(baseline_images=['scatter_post_alpha'], |
646 | 668 | extensions=['png'], remove_text=True, |
647 | 669 | style='default') |
|
0 commit comments