From: <jo...@us...> - 2009-03-10 20:45:59
|
Revision: 6971 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6971&view=rev Author: jouni Date: 2009-03-10 20:45:44 +0000 (Tue, 10 Mar 2009) Log Message: ----------- Fix join style bug in pdf. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/tests/backend_driver.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py Added Paths: ----------- trunk/matplotlib/examples/api/joinstyle.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-09 15:19:49 UTC (rev 6970) +++ trunk/matplotlib/CHANGELOG 2009-03-10 20:45:44 UTC (rev 6971) @@ -1,3 +1,5 @@ +2009-03-10 Fix join style bug in pdf. - JKS + 2009-03-07 Add pyplot access to figure number list - EF 2009-02-28 hashing of FontProperties accounts current rcParams - JJL Added: trunk/matplotlib/examples/api/joinstyle.py =================================================================== --- trunk/matplotlib/examples/api/joinstyle.py (rev 0) +++ trunk/matplotlib/examples/api/joinstyle.py 2009-03-10 20:45:44 UTC (rev 6971) @@ -0,0 +1,31 @@ +#!/usr/bin/env python +""" +Illustrate the three different join styles +""" + +import numpy as np +import matplotlib +import matplotlib.pyplot as plt + +def plot_angle(ax, x, y, angle, style): + phi = angle/180*np.pi + xx = [x+.5,x,x+.5*np.cos(phi)] + yy = [y,y,y+.5*np.sin(phi)] + ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style) + ax.plot(xx[1:], yy[1:], lw=1, color='black') + ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black') + ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3) + ax.text(x,y+.2,'%.0f degrees' % angle) + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.set_title('Join style') + +for x,style in enumerate((('miter', 'round', 'bevel'))): + ax.text(x, 5, style) + for i in range(5): + plot_angle(ax, x, i, pow(2.0,3+i), style) + +ax.set_xlim(-.5,2.75) +ax.set_ylim(-.5,5.5) +plt.show() Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2009-03-09 15:19:49 UTC (rev 6970) +++ trunk/matplotlib/examples/tests/backend_driver.py 2009-03-10 20:45:44 UTC (rev 6971) @@ -211,6 +211,7 @@ 'font_family_rc.py', 'histogram_demo.py', 'image_zcoord.py', + 'joinstyle.py', 'legend_demo.py', 'line_with_text.py', 'logo2.py', Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-03-09 15:19:49 UTC (rev 6970) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-03-10 20:45:44 UTC (rev 6971) @@ -427,6 +427,9 @@ self.beginStream(contentObject.id, self.reserveObject('length of content stream')) + # Initialize the pdf graphics state to match the default mpl + # graphics context: currently only the join style needs to be set + self.output(GraphicsContextPdf.joinstyles['round'], Op.setlinejoin) def close(self): self.endStream() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |