@@ -426,8 +426,12 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans,
426426 fill = rgbFace is not None )
427427 writeln (self .fh , r"}" )
428428
429+ maxcoord = 16383 / 72.27 * self .dpi # Max dimensions in LaTeX.
430+ clip = (- maxcoord , - maxcoord , maxcoord , maxcoord )
431+
429432 # draw marker for each vertex
430- for point , code in path .iter_segments (trans , simplify = False ):
433+ for point , code in path .iter_segments (trans , simplify = False ,
434+ clip = clip ):
431435 x , y = point [0 ] * f , point [1 ] * f
432436 writeln (self .fh , r"\begin{pgfscope}" )
433437 writeln (self .fh , r"\pgfsys@transformshift{%fin}{%fin}" % (x , y ))
@@ -564,11 +568,13 @@ def _print_pgf_path(self, gc, path, transform, rgbFace=None):
564568 f = 1. / self .dpi
565569 # check for clip box / ignore clip for filled paths
566570 bbox = gc .get_clip_rectangle () if gc else None
571+ maxcoord = 16383 / 72.27 * self .dpi # Max dimensions in LaTeX.
567572 if bbox and (rgbFace is None ):
568573 p1 , p2 = bbox .get_points ()
569- clip = (p1 [0 ], p1 [1 ], p2 [0 ], p2 [1 ])
574+ clip = (max (p1 [0 ], - maxcoord ), max (p1 [1 ], - maxcoord ),
575+ min (p2 [0 ], maxcoord ), min (p2 [1 ], maxcoord ))
570576 else :
571- clip = None
577+ clip = ( - maxcoord , - maxcoord , maxcoord , maxcoord )
572578 # build path
573579 for points , code in path .iter_segments (transform , clip = clip ):
574580 if code == Path .MOVETO :
0 commit comments