From: <md...@us...> - 2010-06-24 14:48:06
|
Revision: 8461 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8461&view=rev Author: mdboom Date: 2010-06-24 14:48:00 +0000 (Thu, 24 Jun 2010) Log Message: ----------- [3020704] set_xlim() problem Bug in PathClipper when vertices fall precisely on the clipping edge. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/tests/test_simplification.py trunk/matplotlib/src/path_converters.h Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf =================================================================== (Binary files differ) Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png =================================================================== (Binary files differ) Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg (rev 0) +++ trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg 2010-06-24 14:48:00 UTC (rev 8461) @@ -0,0 +1,104 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<!-- Created with matplotlib (http://matplotlib.sourceforge.net/) --> +<svg width="144pt" height="72pt" viewBox="0 0 144 72" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.1" + id="svg1"> +<filter id="colorAdd"><feComposite in="SourceGraphic" in2="BackgroundImage" operator="arithmetic" k2="1" k3="1"/></filter> +<g id="figure1"> +<g id="patch1"> +<path style="fill: #ffffff; stroke: #ffffff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 72.000000L144.000000 72.000000L144.000000 0.000000 +L0.000000 0.000000L0.000000 72.000000"/> +</g> +<g id="axes1"> +<g id="patch2"> +<path style="fill: #ffffff; opacity: 1.000000" d="M0.000000 72.000000L144.000000 72.000000L144.000000 0.000000 +L0.000000 0.000000L0.000000 72.000000"/> +</g> +<g id="line2d1"> +<defs> + <clipPath id="p7a7a30041bcd0eda414889f4295b8ec2"> +<rect x="0.000000" y="0.000000" width="144.000000" height="72.000000"/> + </clipPath> +</defs><path style="fill: none; stroke: #0000ff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" clip-path="url(#p7a7a30041bcd0eda414889f4295b8ec2)" d="M-180.000000 72.000000L36.000000 72.000000L72.000000 14.400000 +L108.000000 72.000000L144.000000 0.000000"/> +</g> +<g id="matplotlib.axis1"> +<g id="xtick1"> +<g id="line2d2"> +<defs><path id="m30e32995789d870ad79a2e54c91cf9c6" d="M0.000000 0.000000L0.000000 -4.000000"/></defs> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="0.000000" y="72.000000"/> +</g></g> +</g> +<g id="xtick2"> +<g id="line2d3"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="36.000000" y="72.000000"/> +</g></g> +</g> +<g id="xtick3"> +<g id="line2d4"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="72.000000" y="72.000000"/> +</g></g> +</g> +<g id="xtick4"> +<g id="line2d5"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="108.000000" y="72.000000"/> +</g></g> +</g> +<g id="xtick5"> +<g id="line2d6"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="144.000000" y="72.000000"/> +</g></g> +</g> +</g> +<g id="matplotlib.axis2"> +<g id="ytick1"> +<g id="line2d7"> +<defs><path id="m3400efa6b1638b3fea9e19e898273957" d="M0.000000 0.000000L4.000000 0.000000"/></defs> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="72.000000"/> +</g></g> +</g> +<g id="ytick2"> +<g id="line2d8"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="57.600000"/> +</g></g> +</g> +<g id="ytick3"> +<g id="line2d9"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="43.200000"/> +</g></g> +</g> +<g id="ytick4"> +<g id="line2d10"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="28.800000"/> +</g></g> +</g> +<g id="ytick5"> +<g id="line2d11"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="14.400000"/> +</g></g> +</g> +<g id="ytick6"> +<g id="line2d12"> +<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="0.000000"/> +</g></g> +</g> +</g> +<g id="patch3"> +<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 0.000000L144.000000 0.000000"/> +</g> +<g id="patch4"> +<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M144.000000 72.000000L144.000000 0.000000"/> +</g> +<g id="patch5"> +<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 72.000000L144.000000 72.000000"/> +</g> +<g id="patch6"> +<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 72.000000L0.000000 0.000000"/> +</g> +</g> +</g> +</svg> Modified: trunk/matplotlib/lib/matplotlib/tests/test_simplification.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_simplification.py 2010-06-24 13:06:03 UTC (rev 8460) +++ trunk/matplotlib/lib/matplotlib/tests/test_simplification.py 2010-06-24 14:48:00 UTC (rev 8461) @@ -186,7 +186,24 @@ else: rcParams['path.simplify'] = True +@image_comparison(baseline_images=['clipper_edge']) +def test_clipper(): + dat = (0, 1, 0, 2, 0, 3, 0, 4, 0, 5) + fig = plt.figure(figsize=(2, 1)) + fig.subplots_adjust(left = 0, bottom = 0, wspace = 0, hspace = 0) + ax = fig.add_axes((0, 0, 1.0, 1.0), ylim = (0, 5), autoscale_on = False) + ax.plot(dat) + ax.xaxis.set_major_locator(plt.MultipleLocator(1)) + ax.xaxis.set_major_formatter(plt.NullFormatter()) + ax.yaxis.set_major_locator(plt.MultipleLocator(1)) + ax.yaxis.set_major_formatter(plt.NullFormatter()) + ax.xaxis.set_ticks_position('bottom') + ax.yaxis.set_ticks_position('left') + + ax.set_xlim(5, 9) + fig.savefig('clipper_edge') + if __name__=='__main__': import nose nose.runmodule(argv=['-s','--with-doctest'], exit=False) Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2010-06-24 13:06:03 UTC (rev 8460) +++ trunk/matplotlib/src/path_converters.h 2010-06-24 14:48:00 UTC (rev 8461) @@ -288,7 +288,7 @@ PathClipper(VertexSource& source, bool do_clipping, double width, double height) : m_source(&source), m_do_clipping(do_clipping), - m_cliprect(0.0, 0.0, width, height), m_moveto(true), + m_cliprect(-1.0, -1.0, width + 1.0, height + 1.0), m_moveto(true), m_has_next(false) { // empty @@ -296,10 +296,13 @@ PathClipper(VertexSource& source, bool do_clipping, const agg::rect_base<double>& rect) : - m_source(&source), m_do_clipping(do_clipping), - m_cliprect(rect), m_moveto(true), m_has_next(false) + m_source(&source), m_do_clipping(do_clipping), + m_cliprect(rect), m_moveto(true), m_has_next(false) { - // empty + m_cliprect.x1 -= 1.0; + m_cliprect.y1 -= 1.0; + m_cliprect.x2 += 1.0; + m_cliprect.y2 += 1.0; } inline void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |