def test_clipping_of_log(): # issue 804 M, L, C = Path.MOVETO, Path.LINETO, Path.CLOSEPOLY points = [(0.2, -99), (0.4, -99), (0.4, 20), (0.2, 20), (0.2, -99)] codes = [M, L, L, L, C] path = Path(points, codes) # something like this happens in plotting logarithmic histograms trans = BlendedGenericTransform(Affine2D(), LogScale.Log10Transform("clip")) tpath = trans.transform_path_non_affine(path) result = tpath.iter_segments(trans.get_affine(), clip=(0, 0, 100, 100), simplify=False) tpoints, tcodes = list(zip(*result)) assert np.allclose(tcodes, [M, L, L, L, C])
def test_clipping_of_log(): # issue 804 M, L, C = Path.MOVETO, Path.LINETO, Path.CLOSEPOLY points = [(0.2, -99), (0.4, -99), (0.4, 20), (0.2, 20), (0.2, -99)] codes = [M, L, L, L, C] path = Path(points, codes) # something like this happens in plotting logarithmic histograms trans = BlendedGenericTransform(Affine2D(), LogScale.Log10Transform('clip')) tpath = trans.transform_path_non_affine(path) result = tpath.iter_segments(trans.get_affine(), clip=(0, 0, 100, 100), simplify=False) tpoints, tcodes = list(zip(*result)) assert np.allclose(tcodes, [M, L, L, L, C])
def test_clipping_of_log(): # issue 804 M, L, C = Path.MOVETO, Path.LINETO, Path.CLOSEPOLY points = [(0.2, -99), (0.4, -99), (0.4, 20), (0.2, 20), (0.2, -99)] codes = [M, L, L, L, C] path = Path(points, codes) # something like this happens in plotting logarithmic histograms trans = BlendedGenericTransform(Affine2D(), LogScale.Log10Transform("clip")) tpath = trans.transform_path_non_affine(path) result = tpath.iter_segments(trans.get_affine(), clip=(0, 0, 100, 100), simplify=False) tpoints, tcodes = list(zip(*result)) # Because y coordinate -99 is outside the clip zone, the first # line segment is effectively removed. That means that the closepoly # operation must be replaced by a move to the first point. assert np.allclose(tcodes, [M, M, L, L, L, C])
def test_clipping_of_log(): # issue 804 M, L, C = Path.MOVETO, Path.LINETO, Path.CLOSEPOLY points = [(0.2, -99), (0.4, -99), (0.4, 20), (0.2, 20), (0.2, -99)] codes = [M, L, L, L, C] path = Path(points, codes) # something like this happens in plotting logarithmic histograms trans = BlendedGenericTransform(Affine2D(), LogScale.Log10Transform('clip')) tpath = trans.transform_path_non_affine(path) result = tpath.iter_segments(trans.get_affine(), clip=(0, 0, 100, 100), simplify=False) tpoints, tcodes = list(zip(*result)) # Because y coordinate -99 is outside the clip zone, the first # line segment is effectively removed. That means that the closepoly # operation must be replaced by a move to the first point. assert np.allclose(tcodes, [M, M, L, L, L, C])