alex arsenovic <ai...@virginia.edu> writes: > the main error is > > Error: /nocurrentpoint in --lineto--
Sounds like this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=2879910&group_id=80706&atid=560720 It's fixed in svn, but I don't think there has been a release after the fix. One way to test if it is indeed the same bug is to apply the following change (svn revision 7899) and try saving a pdf file - it should exit with an error.
Index: lib/matplotlib/backends/backend_pdf.py =================================================================== --- lib/matplotlib/backends/backend_pdf.py (revision 7898) +++ lib/matplotlib/backends/backend_pdf.py (revision 7899) @@ -1206,8 +1206,12 @@ last_points = None for points, code in path.iter_segments(transform, clip=clip): if code == Path.MOVETO: + # This is allowed anywhere in the path cmds.extend(points) cmds.append(Op.moveto) + elif last_points is None: + # The other operations require a previous point + raise ValueError, 'Path lacks initial MOVETO' elif code == Path.LINETO: cmds.extend(points) cmds.append(Op.lineto)
If it is the same bug, revision 7900 (attached) should fix it, but that requires recompilation and not just patching python files.
Index: src/path_converters.h =================================================================== --- src/path_converters.h (revision 7899) +++ src/path_converters.h (revision 7900) @@ -684,9 +684,15 @@ { if (m_origdNorm2 != 0.0) { - queue_push(agg::path_cmd_line_to, m_nextX, m_nextY); + queue_push((m_moveto || m_after_moveto) ? + agg::path_cmd_move_to : agg::path_cmd_line_to, + m_nextX, m_nextY); + m_moveto = false; } - queue_push(agg::path_cmd_line_to, m_lastx, m_lasty); + queue_push((m_moveto || m_after_moveto) ? + agg::path_cmd_move_to : agg::path_cmd_line_to, + m_lastx, m_lasty); + m_moveto = false; queue_push(agg::path_cmd_stop, 0.0, 0.0); } Index: lib/matplotlib/tests/test_simplification.py =================================================================== --- lib/matplotlib/tests/test_simplification.py (revision 7899) +++ lib/matplotlib/tests/test_simplification.py (revision 7900) @@ -2,11 +2,10 @@ import matplotlib from matplotlib.testing.decorators import image_comparison, knownfailureif import matplotlib.pyplot as plt -from matplotlib import patches, path from pylab import * import numpy as np -from matplotlib import patches, path +from matplotlib import patches, path, transforms nan = np.nan Path = path.Path @@ -134,6 +133,38 @@ assert len(simplified) == 13 +def test_start_with_moveto(): + # Should be entirely clipped away to a single MOVETO + data = """ +ZwAAAAku+v9UAQAA+Tj6/z8CAADpQ/r/KAMAANlO+v8QBAAAyVn6//UEAAC6ZPr/2gUAAKpv+v+8 +BgAAm3r6/50HAACLhfr/ewgAAHyQ+v9ZCQAAbZv6/zQKAABepvr/DgsAAE+x+v/lCwAAQLz6/7wM +AAAxx/r/kA0AACPS+v9jDgAAFN36/zQPAAAF6Pr/AxAAAPfy+v/QEAAA6f36/5wRAADbCPv/ZhIA +AMwT+/8uEwAAvh77//UTAACwKfv/uRQAAKM0+/98FQAAlT/7/z0WAACHSvv//RYAAHlV+/+7FwAA +bGD7/3cYAABea/v/MRkAAFF2+//pGQAARIH7/6AaAAA3jPv/VRsAACmX+/8JHAAAHKL7/7ocAAAP +rfv/ah0AAAO4+/8YHgAA9sL7/8QeAADpzfv/bx8AANzY+/8YIAAA0OP7/78gAADD7vv/ZCEAALf5 ++/8IIgAAqwT8/6kiAACeD/z/SiMAAJIa/P/oIwAAhiX8/4QkAAB6MPz/HyUAAG47/P+4JQAAYkb8 +/1AmAABWUfz/5SYAAEpc/P95JwAAPmf8/wsoAAAzcvz/nCgAACd9/P8qKQAAHIj8/7cpAAAQk/z/ +QyoAAAWe/P/MKgAA+aj8/1QrAADus/z/2isAAOO+/P9eLAAA2Mn8/+AsAADM1Pz/YS0AAMHf/P/g +LQAAtur8/10uAACr9fz/2C4AAKEA/f9SLwAAlgv9/8ovAACLFv3/QDAAAIAh/f+1MAAAdSz9/ycx +AABrN/3/mDEAAGBC/f8IMgAAVk39/3UyAABLWP3/4TIAAEFj/f9LMwAANm79/7MzAAAsef3/GjQA +ACKE/f9+NAAAF4/9/+E0AAANmv3/QzUAAAOl/f+iNQAA+a/9/wA2AADvuv3/XDYAAOXF/f+2NgAA +29D9/w83AADR2/3/ZjcAAMfm/f+7NwAAvfH9/w44AACz/P3/XzgAAKkH/v+vOAAAnxL+//04AACW +Hf7/SjkAAIwo/v+UOQAAgjP+/905AAB5Pv7/JDoAAG9J/v9pOgAAZVT+/606AABcX/7/7zoAAFJq +/v8vOwAASXX+/207AAA/gP7/qjsAADaL/v/lOwAALZb+/x48AAAjof7/VTwAABqs/v+LPAAAELf+ +/788AAAHwv7/8TwAAP7M/v8hPQAA9df+/1A9AADr4v7/fT0AAOLt/v+oPQAA2fj+/9E9AADQA/// ++T0AAMYO//8fPgAAvRn//0M+AAC0JP//ZT4AAKsv//+GPgAAojr//6U+AACZRf//wj4AAJBQ///d +PgAAh1v///c+AAB+Zv//Dz8AAHRx//8lPwAAa3z//zk/AABih///TD8AAFmS//9dPwAAUJ3//2w/ +AABHqP//ej8AAD6z//+FPwAANb7//48/AAAsyf//lz8AACPU//+ePwAAGt///6M/AAAR6v//pj8A +AAj1//+nPwAA/////w==""" + + verts = np.fromstring(data.decode('base64'), dtype='<i4') + verts = verts.reshape((len(verts) / 2, 2)) + path = Path(verts) + segs = path.iter_segments(transforms.IdentityTransform, clip=(0.0, 0.0, 100.0, 100.0)) + segs = list(segs) + assert len(segs) == 1 + assert segs[0][1] == Path.MOVETO + if __name__=='__main__': import nose nose.runmodule(argv=['-s','--with-doctest'], exit=False) Index: lib/matplotlib/path.py =================================================================== --- lib/matplotlib/path.py (revision 7899) +++ lib/matplotlib/path.py (revision 7900) @@ -115,6 +115,8 @@ codes = np.asarray(codes, self.code_type) assert codes.ndim == 1 assert len(codes) == len(vertices) + if len(codes): + assert codes[0] == self.MOVETO assert vertices.ndim == 2 assert vertices.shape[1] == 2
-- Jouni K. Seppänen http://www.iki.fi/jks
------------------------------------------------------------------------------
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users