Ejemplo n.º 1
0
def add_segments(ax: Axes, segments: Segment, alpha=0.3, **kwargs):
    """ Draw vertical bands on the plot, one for each segment. """
    visible_segs = segments.intersection(ax.get_xlim())
    plot_segments(visible_segs,
                  axes=ax,
                  fullheight=True,
                  alpha=alpha,
                  **kwargs)
Ejemplo n.º 2
0
def test_segment_intersection_2():
    s1 = Segment([[0, 10], [20, 30], [50, 100]])
    s2 = Segment([[4, 6], [15, 25], [40, 200]])
    s3 = Segment([[8, 20], [35, 60], [150, 180]])
    nose.tools.assert_equal(s1 & s2 & s3, s1.intersection(s2, s3))
Ejemplo n.º 3
0
def test_segment_intersection():
    s1 = Segment([[0, 10], [20, 30], [50, 100]])
    s2 = Segment([[4, 6], [15, 25], [40, 200]])
    s1.intersection(s2)
    np.testing.assert_equal(s1._data, np.array([[4, 6], [20, 25], [50, 100]]))