Revision: 6688
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6688&view=rev
Author: leejjoon
Date: 2008-12-21 03:46:05 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
fix hatch bug in pdf backend
Modified Paths:
--------------
branches/v0_98_5_maint/CHANGELOG
branches/v0_98_5_maint/examples/pylab_examples/hatch_demo.py
branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
branches/v0_98_5_maint/lib/matplotlib/patches.py
Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG 2008-12-19 22:48:11 UTC (rev 6687)
+++ branches/v0_98_5_maint/CHANGELOG 2008-12-21 03:46:05 UTC (rev 6688)
@@ -1,5 +1,8 @@
-2008-12-19 Update Axes.legend documnetation. /api/api_changes.rst is also
- updated to describe chages in keyword parameters.
+2008-12-20 fix the hatch bug in the pdf backend. minor update
+ in docs and example - JJL
+
+2008-12-19 Update Axes.legend documnetation. /api/api_changes.rst is also
+ updated to describe chages in keyword parameters.
Issue a warning if old keyword parameters are used. - JJL
=======================================================================
Modified: branches/v0_98_5_maint/examples/pylab_examples/hatch_demo.py
===================================================================
--- branches/v0_98_5_maint/examples/pylab_examples/hatch_demo.py
2008-12-19 22:48:11 UTC (rev 6687)
+++ branches/v0_98_5_maint/examples/pylab_examples/hatch_demo.py
2008-12-21 03:46:05 UTC (rev 6688)
@@ -1,18 +1,25 @@
"""
-Hatching (pattern filled polygons) is supported currently on PS
+Hatching (pattern filled polygons) is supported currently on PS and PDF
backend only. See the set_patch method in
http://matplotlib.sf.net/matplotlib.patches.html#Patch
for details
"""
-import matplotlib
-matplotlib.use('PS')
-from pylab import figure
+import matplotlib.pyplot as plt
-fig = figure()
-ax = fig.add_subplot(111)
-bars = ax.bar(range(1,5), range(1,5), color='gray', ecolor='black')
+fig = plt.figure()
+ax1 = fig.add_subplot(121)
+ax1.annotate("Hatch is only supported in the PS and PDF backend", (1, 1),
+ xytext=(0, 5),
+ xycoords="axes fraction", textcoords="offset points", ha="center"
+ )
+ax1.bar(range(1,5), range(1,5), color='gray', ecolor='black', hatch="/")
+
+ax2 = fig.add_subplot(122)
+bars = ax2.bar(range(1,5), range(1,5), color='gray', ecolor='black')
+
patterns = ('/', '+', 'x', '\\')
for bar, pattern in zip(bars, patterns):
bar.set_hatch(pattern)
-fig.savefig('hatch4.ps')
+
+plt.show()
Modified: branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
2008-12-19 22:48:11 UTC (rev 6687)
+++ branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
2008-12-21 03:46:05 UTC (rev 6688)
@@ -942,7 +942,7 @@
def hatchPattern(self, lst):
pattern = self.hatchPatterns.get(lst, None)
if pattern is not None:
- return pattern[0]
+ return pattern
name = Name('H%d' % self.nextHatch)
self.nextHatch += 1
@@ -1233,7 +1233,7 @@
def get_image_magnification(self):
return self.image_dpi/72.0
-
+
def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
# MGDTODO: Support clippath here
gc = self.new_gc()
Modified: branches/v0_98_5_maint/lib/matplotlib/patches.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/patches.py 2008-12-19 22:48:11 UTC
(rev 6687)
+++ branches/v0_98_5_maint/lib/matplotlib/patches.py 2008-12-21 03:46:05 UTC
(rev 6688)
@@ -247,12 +247,12 @@
CURRENT LIMITATIONS:
- 1. Hatching is supported in the PostScript backend only.
+ 1. Hatching is supported in the PostScript and the PDF backend only.
2. Hatching is done with solid black lines of width 0.
- ACCEPTS: [ '/' | '\\' | '|' | '-' | '#' | 'x' ]
+ ACCEPTS: [ '/' | '\\' | '|' | '-' | '#' | 'x' ] (ps & pdf backend only)
"""
self._hatch = h
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins