You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <md...@us...> - 2008-12-29 14:42:23
|
Revision: 6712
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6712&view=rev
Author: mdboom
Date: 2008-12-29 14:42:20 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Fix path simplification by a) making it more conservative about when it will simplify based on segment length, and b) honoring path.simplify rcParam in Agg backend.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/config/rcsetup.py
trunk/matplotlib/lib/matplotlib/path.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-12-29 14:25:47 UTC (rev 6711)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-12-29 14:42:20 UTC (rev 6712)
@@ -479,7 +479,7 @@
'svg.embed_char_paths' : [True, validate_bool], # True to save all characters as paths in the SVG
'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
- 'path.simplify' : [False, validate_bool]
+ 'path.simplify' : [True, validate_bool]
}
if __name__ == '__main__':
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py 2008-12-29 14:25:47 UTC (rev 6711)
+++ trunk/matplotlib/lib/matplotlib/path.py 2008-12-29 14:42:20 UTC (rev 6712)
@@ -109,8 +109,9 @@
assert vertices.ndim == 2
assert vertices.shape[1] == 2
- self.should_simplify = (len(vertices) >= 128 and
- (codes is None or np.all(codes <= Path.LINETO)))
+ self.should_simplify = (rcParam['path.simplify'] and
+ (len(vertices) >= 128 and
+ (codes is None or np.all(codes <= Path.LINETO))))
self.has_nonfinite = not np.isfinite(vertices).all()
self.codes = codes
self.vertices = vertices
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-12-29 14:25:47 UTC (rev 6711)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-12-29 14:42:20 UTC (rev 6712)
@@ -518,7 +518,7 @@
'docstring.hardcopy' : [False, validate_bool], # set this when you want to generate hardcopy docstring
'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
- 'path.simplify' : [False, validate_bool],
+ 'path.simplify' : [True, validate_bool],
'agg.path.chunksize' : [0, validate_int] # 0 to disable chunking;
# recommend about 20000 to
# enable. Experimental.
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-12-29 14:25:47 UTC (rev 6711)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-12-29 14:42:20 UTC (rev 6712)
@@ -353,7 +353,7 @@
//if the perp vector is less than some number of (squared)
//pixels in size, then merge the current vector
- if (perpdNorm2 < 0.25)
+ if (perpdNorm2 < (1.0 / 9.0))
{
//check if the current vector is parallel or
//anti-parallel to the orig vector. If it is parallel, test
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-29 14:25:57
|
Revision: 6711
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6711&view=rev
Author: mdboom
Date: 2008-12-29 14:25:47 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Oops in last commit
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-29 14:23:24 UTC (rev 6710)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-29 14:25:47 UTC (rev 6711)
@@ -252,7 +252,7 @@
ACCEPTS: [ '/' | '\\' | '|' | '-' | '#' | 'x' ] (ps & pdf backend only)
"""
- self._hatch = h
+ self._hatch = hatch
def get_hatch(self):
'Return the current hatching pattern'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-29 14:23:28
|
Revision: 6710
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6710&view=rev
Author: mdboom
Date: 2008-12-29 14:23:24 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Update hatch documentation.
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/hatch_demo.py
trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/examples/pylab_examples/hatch_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-29 14:10:22 UTC (rev 6709)
+++ trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-29 14:23:24 UTC (rev 6710)
@@ -1,8 +1,6 @@
"""
-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
+Hatching (pattern filled polygons) is supported currently in the PS,
+PDF, SVG and Agg backends only.
"""
import matplotlib.pyplot as plt
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-29 14:10:22 UTC (rev 6709)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-29 14:23:24 UTC (rev 6710)
@@ -228,11 +228,11 @@
'return whether fill is set'
return self.fill
- def set_hatch(self, h):
+ def set_hatch(self, hatch):
"""
Set the hatching pattern
- hatch can be one of::
+ *hatch* can be one of::
/ - diagonal hatching
\ - back diagonal
@@ -247,11 +247,9 @@
CURRENT LIMITATIONS:
- 1. Hatching is supported in the PostScript and the PDF backend only.
+ 1. Hatching is supported in the PostScript, PDF, SVG and Agg
+ backends only.
- 2. Hatching is done with solid black lines of width 0.
-
-
ACCEPTS: [ '/' | '\\' | '|' | '-' | '#' | 'x' ] (ps & pdf backend only)
"""
self._hatch = h
@@ -2655,7 +2653,7 @@
"""
path = make_path_regular(path)
-
+
if aspect_ratio is not None:
# Squeeze the given height by the aspect_ratio
@@ -2808,27 +2806,27 @@
[(x3+ddxB, y3+ddyB)]]),
path.codes)]
_fillable = [False]
-
+
if self.beginarrow:
if self.fillbegin:
p = np.concatenate([verticesA, [verticesA[0], verticesA[0]], ])
- c = np.concatenate([codesA, [Path.LINETO, Path.CLOSEPOLY]])
+ c = np.concatenate([codesA, [Path.LINETO, Path.CLOSEPOLY]])
_path.append(Path(p, c))
_fillable.append(True)
else:
_path.append(Path(verticesA, codesA))
_fillable.append(False)
-
+
if self.endarrow:
if self.fillend:
_fillable.append(True)
p = np.concatenate([verticesB, [verticesB[0], verticesB[0]], ])
- c = np.concatenate([codesB, [Path.LINETO, Path.CLOSEPOLY]])
+ c = np.concatenate([codesB, [Path.LINETO, Path.CLOSEPOLY]])
_path.append(Path(p, c))
else:
_fillable.append(False)
_path.append(Path(verticesB, codesB))
-
+
return _path, _fillable
@@ -2926,7 +2924,7 @@
super(ArrowStyle.CurveFilledA, self).__init__( \
beginarrow=True, endarrow=False,
- fillbegin=True, fillend=False,
+ fillbegin=True, fillend=False,
head_length=head_length, head_width=head_width )
_style_list["<|-"] = CurveFilledA
@@ -2948,7 +2946,7 @@
super(ArrowStyle.CurveFilledB, self).__init__( \
beginarrow=False, endarrow=True,
- fillbegin=False, fillend=True,
+ fillbegin=False, fillend=True,
head_length=head_length, head_width=head_width )
_style_list["-|>"] = CurveFilledB
@@ -2970,7 +2968,7 @@
super(ArrowStyle.CurveFilledAB, self).__init__( \
beginarrow=True, endarrow=True,
- fillbegin=True, fillend=True,
+ fillbegin=True, fillend=True,
head_length=head_length, head_width=head_width )
_style_list["<|-|>"] = CurveFilledAB
@@ -3532,7 +3530,7 @@
if cbook.iterable(fillable):
_path = concatenate_paths(_path)
-
+
return self.get_transform().inverted().transform_path(_path)
@@ -3604,8 +3602,8 @@
if not cbook.iterable(fillable):
path = [path]
fillable = [fillable]
-
+
affine = transforms.IdentityTransform()
renderer.open_group('patch', self.get_gid())
@@ -3615,6 +3613,6 @@
renderer.draw_path(gc, p, affine, rgbFace)
else:
renderer.draw_path(gc, p, affine, None)
-
+
renderer.close_group('patch')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-29 14:10:31
|
Revision: 6709
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6709&view=rev
Author: mdboom
Date: 2008-12-29 14:10:22 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Oops in hatch_demo.py
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/hatch_demo.py
Modified: trunk/matplotlib/examples/pylab_examples/hatch_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-29 14:08:13 UTC (rev 6708)
+++ trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-29 14:10:22 UTC (rev 6709)
@@ -12,7 +12,7 @@
xytext=(0, 5),
xycoords="axes fraction", textcoords="offset points", ha="center"
)
-ax1.bar(range(1,5), range(1,5), color='gray', edgecolor='red', hatch="/")
+ax1.bar(range(1,5), range(1,5), color='gray', edgecolor='black', hatch="/")
ax2 = fig.add_subplot(122)
@@ -23,5 +23,3 @@
bar.set_hatch(pattern)
plt.show()
-plt.savefig("test.pdf")
-plt.savefig("test.ps")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-29 14:08:16
|
Revision: 6708
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6708&view=rev
Author: mdboom
Date: 2008-12-29 14:08:13 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Merge branch 'hatching'
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/hatch_demo.py
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
trunk/matplotlib/lib/matplotlib/path.py
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_backend_agg.h
Modified: trunk/matplotlib/examples/pylab_examples/hatch_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -12,7 +12,7 @@
xytext=(0, 5),
xycoords="axes fraction", textcoords="offset points", ha="center"
)
-ax1.bar(range(1,5), range(1,5), color='gray', ecolor='black', hatch="/")
+ax1.bar(range(1,5), range(1,5), color='gray', edgecolor='red', hatch="/")
ax2 = fig.add_subplot(122)
@@ -23,3 +23,5 @@
bar.set_hatch(pattern)
plt.show()
+plt.savefig("test.pdf")
+plt.savefig("test.ps")
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -30,6 +30,7 @@
import matplotlib.colors as colors
import matplotlib.transforms as transforms
import matplotlib.widgets as widgets
+import matplotlib.path as path
from matplotlib import rcParams
class RendererBase:
@@ -679,6 +680,14 @@
"""
return self._hatch
+ def get_hatch_path(self, density=6.0):
+ """
+ Returns a Path for the current hatch.
+ """
+ if self._hatch is None:
+ return None
+ return path.Path.hatch(self._hatch, density)
+
class Event:
"""
A matplotlib event. Attach additional attributes as defined in
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -73,9 +73,13 @@
'debug-annoying')
def draw_path(self, gc, path, transform, rgbFace=None):
+ """
+ Draw the path
+ """
nmax = rcParams['agg.path.chunksize'] # here at least for testing
npts = path.vertices.shape[0]
- if nmax > 100 and npts > nmax and path.should_simplify and rgbFace is None:
+ if (nmax > 100 and npts > nmax and path.should_simplify and
+ rgbFace is None and gc.get_hatch() is None):
nch = npy.ceil(npts/float(nmax))
chsize = int(npy.ceil(npts/nch))
i0 = npy.arange(0, npts, chsize)
@@ -93,7 +97,6 @@
else:
self._renderer.draw_path(gc, path, transform, rgbFace)
-
def draw_mathtext(self, gc, x, y, s, prop, angle):
"""
Draw the math text using matplotlib.mathtext
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -953,21 +953,20 @@
'CA': alpha, 'ca': alpha })
return name
- def hatchPattern(self, lst):
- pattern = self.hatchPatterns.get(lst, None)
+ def hatchPattern(self, hatch_style):
+ pattern = self.hatchPatterns.get(hatch_style, None)
if pattern is not None:
return pattern
name = Name('H%d' % self.nextHatch)
self.nextHatch += 1
- self.hatchPatterns[lst] = name
+ self.hatchPatterns[hatch_style] = name
return name
def writeHatches(self):
hatchDict = dict()
- sidelen = 144.0
- density = 24.0
- for lst, name in self.hatchPatterns.items():
+ sidelen = 72.0
+ for hatch_style, name in self.hatchPatterns.items():
ob = self.reserveObject('hatch pattern')
hatchDict[name] = ob
res = { 'Procsets':
@@ -983,33 +982,21 @@
# lst is a tuple of stroke color, fill color,
# number of - lines, number of / lines,
# number of | lines, number of \ lines
- rgb = lst[0]
+ rgb = hatch_style[0]
self.output(rgb[0], rgb[1], rgb[2], Op.setrgb_stroke)
- if lst[1] is not None:
- rgb = lst[1]
+ if hatch_style[1] is not None:
+ rgb = hatch_style[1]
self.output(rgb[0], rgb[1], rgb[2], Op.setrgb_nonstroke,
0, 0, sidelen, sidelen, Op.rectangle,
Op.fill)
- if lst[2]: # -
- for j in npy.arange(0.0, sidelen, density/lst[2]):
- self.output(0, j, Op.moveto,
- sidelen, j, Op.lineto)
- if lst[3]: # /
- for j in npy.arange(0.0, sidelen, density/lst[3]):
- self.output(0, j, Op.moveto,
- sidelen-j, sidelen, Op.lineto,
- sidelen-j, 0, Op.moveto,
- sidelen, j, Op.lineto)
- if lst[4]: # |
- for j in npy.arange(0.0, sidelen, density/lst[4]):
- self.output(j, 0, Op.moveto,
- j, sidelen, Op.lineto)
- if lst[5]: # \
- for j in npy.arange(sidelen, 0.0, -density/lst[5]):
- self.output(sidelen, j, Op.moveto,
- j, sidelen, Op.lineto,
- j, 0, Op.moveto,
- 0, j, Op.lineto)
+
+ self.output(0.1, Op.setlinewidth)
+
+ # TODO: We could make this dpi-dependent, but that would be
+ # an API change
+ self.output(*self.pathOperations(
+ Path.hatch(hatch_style[2]),
+ Affine2D().scale(sidelen)))
self.output(Op.stroke)
self.endStream()
@@ -1735,13 +1722,8 @@
return [Name('DeviceRGB'), Op.setcolorspace_nonstroke]
else:
hatch = hatch.lower()
- lst = ( self._rgb,
- self._fillcolor,
- hatch.count('-') + hatch.count('+'),
- hatch.count('/') + hatch.count('x'),
- hatch.count('|') + hatch.count('+'),
- hatch.count('\\') + hatch.count('x') )
- name = self.file.hatchPattern(lst)
+ hatch_style = (self._rgb, self._fillcolor, hatch)
+ name = self.file.hatchPattern(hatch_style)
return [Name('Pattern'), Op.setcolorspace_nonstroke,
name, Op.setcolor_nonstroke]
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -31,7 +31,7 @@
from matplotlib._mathtext_data import uni2type1
from matplotlib.text import Text
from matplotlib.path import Path
-from matplotlib.transforms import IdentityTransform
+from matplotlib.transforms import Affine2D
import numpy as npy
import binascii
@@ -163,7 +163,7 @@
self.linedash = None
self.fontname = None
self.fontsize = None
- self.hatch = None
+ self._hatches = {}
self.image_magnification = imagedpi/72.0
self._clip_paths = {}
self._path_collection_id = 0
@@ -231,58 +231,36 @@
if store: self.fontname = fontname
if store: self.fontsize = fontsize
- def set_hatch(self, hatch):
- """
- hatch can be one of:
- / - diagonal hatching
- \ - back diagonal
- | - vertical
- - - horizontal
- + - crossed
- X - crossed diagonal
+ def create_hatch(self, hatch):
+ sidelen = 72
+ if self._hatches.has_key(hatch):
+ return self._hatches[hatch]
+ name = 'H%d' % len(self._hatches)
+ self._pswriter.write("""\
+ << /PatternType 1
+ /PaintType 2
+ /TilingType 2
+ /BBox[0 0 %(sidelen)d %(sidelen)d]
+ /XStep %(sidelen)d
+ /YStep %(sidelen)d
- letters can be combined, in which case all the specified
- hatchings are done
+ /PaintProc {
+ pop
+ 0 setlinewidth
+""" % locals())
+ self._pswriter.write(
+ self._convert_path(Path.hatch(hatch), Affine2D().scale(72.0)))
+ self._pswriter.write("""\
+ stroke
+ } bind
+ >>
+ matrix
+ makepattern
+ /%(name)s exch def
+""" % locals())
+ self._hatches[hatch] = name
+ return name
- if same letter repeats, it increases the density of hatching
- in that direction
- """
- hatches = {'horiz':0, 'vert':0, 'diag1':0, 'diag2':0}
-
- for letter in hatch:
- if (letter == '/'): hatches['diag2'] += 1
- elif (letter == '\\'): hatches['diag1'] += 1
- elif (letter == '|'): hatches['vert'] += 1
- elif (letter == '-'): hatches['horiz'] += 1
- elif (letter == '+'):
- hatches['horiz'] += 1
- hatches['vert'] += 1
- elif (letter.lower() == 'x'):
- hatches['diag1'] += 1
- hatches['diag2'] += 1
-
- def do_hatch(angle, density):
- if (density == 0): return ""
- return """\
- gsave
- eoclip %s rotate 0.0 0.0 0.0 0.0 setrgbcolor 0 setlinewidth
- /hatchgap %d def
- pathbbox /hatchb exch def /hatchr exch def /hatcht exch def /hatchl exch def
- hatchl cvi hatchgap idiv hatchgap mul
- hatchgap
- hatchr cvi hatchgap idiv hatchgap mul
- {hatcht m 0 hatchb hatcht sub r }
- for
- stroke
- grestore
- """ % (angle, 12/density)
- self._pswriter.write("gsave\n")
- self._pswriter.write(do_hatch(90, hatches['horiz']))
- self._pswriter.write(do_hatch(0, hatches['vert']))
- self._pswriter.write(do_hatch(45, hatches['diag1']))
- self._pswriter.write(do_hatch(-45, hatches['diag2']))
- self._pswriter.write("grestore\n")
-
def get_canvas_width_height(self):
'return the canvas width and height in display coords'
return self.width, self.height
@@ -816,15 +794,17 @@
if fill:
if stroke:
write("gsave\n")
- self.set_color(store=0, *rgbFace[:3])
- write("fill\ngrestore\n")
- else:
- self.set_color(store=0, *rgbFace[:3])
- write("fill\n")
+ self.set_color(store=0, *rgbFace[:3])
+ write("fill\n")
+ if stroke:
+ write("grestore\n")
hatch = gc.get_hatch()
if hatch:
- self.set_hatch(hatch)
+ hatch_name = self.create_hatch(hatch)
+ write("gsave\n")
+ write("[/Pattern [/DeviceRGB]] setcolorspace %f %f %f " % gc.get_rgb()[:3])
+ write("%s setcolor fill grestore\n" % hatch_name)
if stroke:
write("stroke\n")
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -57,6 +57,7 @@
self._markers = {}
self._path_collection_id = 0
self._imaged = {}
+ self._hatchd = {}
self.mathtext_parser = MathTextParser('SVG')
svgwriter.write(svgProlog%(width,height,width,height))
@@ -90,15 +91,38 @@
font.set_size(size, 72.0)
return font
+ def _get_hatch(self, gc, rgbFace):
+ """
+ Create a new hatch pattern
+ """
+ HATCH_SIZE = 144
+ dictkey = (gc.get_hatch().lower(), rgbFace, gc.get_rgb())
+ id = self._hatchd.get(dictkey)
+ if id is None:
+ id = 'h%s' % md5(str(dictkey)).hexdigest()
+ self._svgwriter.write('<defs>\n <pattern id="%s" ' % id)
+ self._svgwriter.write('patternUnits="userSpaceOnUse" x="0" y="0" ')
+ self._svgwriter.write(' width="%d" height="%d" >\n' % (HATCH_SIZE, HATCH_SIZE))
+ path_data = self._convert_path(gc.get_hatch_path(), Affine2D().scale(144))
+ path = '<path d="%s" fill="%s" stroke="%s" stroke-width="1.0"/>' % (
+ path_data, rgb2hex(rgbFace[:3]), rgb2hex(gc.get_rgb()[:3]))
+ self._svgwriter.write(path)
+ self._svgwriter.write('\n </pattern>\n</defs>')
+ self._hatchd[dictkey] = id
+ return id
+
def _get_style(self, gc, rgbFace):
"""
return the style string.
style is generated from the GraphicsContext, rgbFace and clippath
"""
- if rgbFace is None:
- fill = 'none'
+ if gc.get_hatch() is not None:
+ fill = "url(#%s)" % self._get_hatch(gc, rgbFace)
else:
- fill = rgb2hex(rgbFace[:3])
+ if rgbFace is None:
+ fill = 'none'
+ else:
+ fill = rgb2hex(rgbFace[:3])
offset, seq = gc.get_dashes()
if seq is None:
@@ -150,7 +174,7 @@
def open_group(self, s, gid=None):
"""
Open a grouping element with label *s*. If *gid* is given, use
- *gid* as the id of the group.
+ *gid* as the id of the group.
"""
if gid:
self._svgwriter.write('<g id="%s">\n' % (gid))
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/lib/matplotlib/path.py 2008-12-29 14:08:13 UTC (rev 6708)
@@ -11,7 +11,7 @@
from matplotlib._path import point_in_path, get_path_extents, \
point_in_path_collection, get_path_collection_extents, \
path_in_path, path_intersects_path, convert_path_to_polygons
-from matplotlib.cbook import simple_linear_interpolation
+from matplotlib.cbook import simple_linear_interpolation, maxdict
class Path(object):
"""
@@ -115,8 +115,8 @@
self.codes = codes
self.vertices = vertices
- #@staticmethod
- def make_compound_path(*args):
+ #@classmethod
+ def make_compound_path(cls, *args):
"""
(staticmethod) Make a compound path from a list of Path
objects. Only polygons (not curves) are supported.
@@ -130,14 +130,14 @@
vertices = np.vstack([x.vertices for x in args])
vertices.reshape((total_length, 2))
- codes = Path.LINETO * np.ones(total_length)
+ codes = cls.LINETO * np.ones(total_length)
i = 0
for length in lengths:
- codes[i] = Path.MOVETO
+ codes[i] = cls.MOVETO
i += length
- return Path(vertices, codes)
- make_compound_path = staticmethod(make_compound_path)
+ return cls(vertices, codes)
+ make_compound_path = classmethod(make_compound_path)
def __repr__(self):
return "Path(%s, %s)" % (self.vertices, self.codes)
@@ -343,7 +343,7 @@
"""
if cls._unit_rectangle is None:
cls._unit_rectangle = \
- Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]])
+ cls([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]])
return cls._unit_rectangle
unit_rectangle = classmethod(unit_rectangle)
@@ -366,7 +366,7 @@
# "points-up"
theta += np.pi / 2.0
verts = np.concatenate((np.cos(theta), np.sin(theta)), 1)
- path = Path(verts)
+ path = cls(verts)
cls._unit_regular_polygons[numVertices] = path
return path
unit_regular_polygon = classmethod(unit_regular_polygon)
@@ -392,7 +392,7 @@
r = np.ones(ns2 + 1)
r[1::2] = innerCircle
verts = np.vstack((r*np.cos(theta), r*np.sin(theta))).transpose()
- path = Path(verts)
+ path = cls(verts)
cls._unit_regular_polygons[(numVertices, innerCircle)] = path
return path
unit_regular_star = classmethod(unit_regular_star)
@@ -466,7 +466,7 @@
codes[0] = cls.MOVETO
codes[-1] = cls.CLOSEPOLY
- cls._unit_circle = Path(vertices, codes)
+ cls._unit_circle = cls(vertices, codes)
return cls._unit_circle
unit_circle = classmethod(unit_circle)
@@ -523,19 +523,19 @@
if is_wedge:
length = n * 3 + 4
- vertices = np.zeros((length, 2), np.float_)
- codes = Path.CURVE4 * np.ones((length, ), Path.code_type)
+ vertices = np.empty((length, 2), np.float_)
+ codes = cls.CURVE4 * np.ones((length, ), cls.code_type)
vertices[1] = [xA[0], yA[0]]
- codes[0:2] = [Path.MOVETO, Path.LINETO]
- codes[-2:] = [Path.LINETO, Path.CLOSEPOLY]
+ codes[0:2] = [cls.MOVETO, cls.LINETO]
+ codes[-2:] = [cls.LINETO, cls.CLOSEPOLY]
vertex_offset = 2
end = length - 2
else:
length = n * 3 + 1
- vertices = np.zeros((length, 2), np.float_)
- codes = Path.CURVE4 * np.ones((length, ), Path.code_type)
+ vertices = np.empty((length, 2), np.float_)
+ codes = cls.CURVE4 * np.ones((length, ), cls.code_type)
vertices[0] = [xA[0], yA[0]]
- codes[0] = Path.MOVETO
+ codes[0] = cls.MOVETO
vertex_offset = 1
end = length
@@ -546,7 +546,7 @@
vertices[vertex_offset+2:end:3, 0] = xB
vertices[vertex_offset+2:end:3, 1] = yB
- return Path(vertices, codes)
+ return cls(vertices, codes)
arc = classmethod(arc)
#@classmethod
@@ -562,6 +562,94 @@
return cls.arc(theta1, theta2, n, True)
wedge = classmethod(wedge)
+ _hatch_dict = maxdict(8)
+ #@classmethod
+ def hatch(cls, hatchpattern, density=6):
+ """
+ Given a hatch specifier, *hatchpattern*, generates a Path that
+ can be used in a repeated hatching pattern. *density* is the
+ number of lines per unit square.
+ """
+ if hatchpattern is None:
+ return None
+
+ hatch = hatchpattern.lower()
+ hatch_path = cls._hatch_dict.get((hatch, density))
+ if hatch_path is not None:
+ return hatch_path
+
+ size = 1.0
+ density = int(density)
+ counts = [
+ hatch.count('-') + hatch.count('+'),
+ hatch.count('/') + hatch.count('x'),
+ hatch.count('|') + hatch.count('+'),
+ hatch.count('\\') + hatch.count('x')
+ ]
+
+ if sum(counts) == 0:
+ return cls([])
+
+ counts = [x * density for x in counts]
+
+ num_vertices = (counts[0] * 2 + counts[1] * 4 +
+ counts[2] * 2 + counts[3] * 4)
+ vertices = np.empty((num_vertices, 2))
+ codes = np.empty((num_vertices,), cls.code_type)
+ codes[0::2] = cls.MOVETO
+ codes[1::2] = cls.LINETO
+
+ cursor = 0
+
+ if counts[0]:
+ vertices_chunk = vertices[cursor:cursor + counts[0] * 2]
+ cursor += counts[0] * 2
+ steps = np.linspace(0.0, 1.0, counts[0], False)
+ vertices_chunk[0::2, 0] = 0.0
+ vertices_chunk[0::2, 1] = steps
+ vertices_chunk[1::2, 0] = size
+ vertices_chunk[1::2, 1] = steps
+
+ if counts[1]:
+ vertices_chunk = vertices[cursor:cursor + counts[1] * 4]
+ cursor += counts[1] * 4
+ steps = np.linspace(0.0, 1.0, counts[1], False)
+ vertices_chunk[0::4, 0] = 0.0
+ vertices_chunk[0::4, 1] = steps
+ vertices_chunk[1::4, 0] = size - steps
+ vertices_chunk[1::4, 1] = size
+ vertices_chunk[2::4, 0] = size - steps
+ vertices_chunk[2::4, 1] = 0.0
+ vertices_chunk[3::4, 0] = size
+ vertices_chunk[3::4, 1] = steps
+
+ if counts[2]:
+ vertices_chunk = vertices[cursor:cursor + counts[2] * 2]
+ cursor += counts[2] * 2
+ steps = np.linspace(0.0, 1.0, counts[2], False)
+ vertices_chunk[0::2, 0] = steps
+ vertices_chunk[0::2, 1] = 0.0
+ vertices_chunk[1::2, 0] = steps
+ vertices_chunk[1::2, 1] = size
+
+ if counts[3]:
+ vertices_chunk = vertices[cursor:cursor + counts[3] * 4]
+ cursor += counts[3] * 4
+ steps = np.linspace(0.0, 1.0, counts[3], False)
+ vertices_chunk[0::4, 0] = size
+ vertices_chunk[0::4, 1] = steps
+ vertices_chunk[1::4, 0] = steps
+ vertices_chunk[1::4, 1] = size
+ vertices_chunk[2::4, 0] = steps
+ vertices_chunk[2::4, 1] = 0.0
+ vertices_chunk[3::4, 0] = 0.0
+ vertices_chunk[3::4, 1] = steps
+
+ hatch_path = cls(vertices, codes)
+ cls._hatch_dict[(hatch, density)] = hatch_path
+ return hatch_path
+ hatch = classmethod(hatch)
+
_get_path_collection_extents = get_path_collection_extents
def get_path_collection_extents(*args):
"""
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-29 14:08:13 UTC (rev 6708)
@@ -30,6 +30,7 @@
#include "agg_span_image_filter_gray.h"
#include "agg_span_image_filter_rgba.h"
#include "agg_span_interpolator_linear.h"
+#include "agg_span_pattern_rgba.h"
#include "agg_conv_shorten_path.h"
#include "util/agg_color_conv_rgb8.h"
@@ -149,6 +150,7 @@
_set_clip_rectangle(gc);
_set_clip_path(gc);
_set_snap(gc);
+ _set_hatch_path(gc);
}
GCAgg::GCAgg(double dpi) :
@@ -273,6 +275,15 @@
}
}
+void
+GCAgg::_set_hatch_path( const Py::Object& gc) {
+ _VERBOSE("GCAgg::_set_hatch_path");
+
+ Py::Object method_obj = gc.getAttr("get_hatch_path");
+ Py::Callable method(method_obj);
+ hatchpath = method.apply(Py::Tuple());
+}
+
const size_t
RendererAgg::PIXELS_PER_INCH(96);
@@ -310,6 +321,7 @@
rendererBase.clear(agg::rgba(1, 1, 1, 0));
rendererAA.attach(rendererBase);
rendererBin.attach(rendererBase);
+ hatchRenderingBuffer.attach(hatchBuffer, HATCH_SIZE, HATCH_SIZE, HATCH_SIZE*4);
}
void RendererAgg::create_alpha_buffers() {
@@ -879,6 +891,55 @@
}
}
+ // Render hatch
+ if (!gc.hatchpath.isNone()) {
+ // Reset any clipping that may be in effect, since we'll be
+ // drawing the hatch in a scratch buffer at origin (0, 0)
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+
+ // Create and transform the path
+ typedef agg::conv_transform<PathIterator> hatch_path_trans_t;
+ typedef SimplifyPath<hatch_path_trans_t> hatch_path_simplify_t;
+ typedef agg::conv_stroke<hatch_path_simplify_t> hatch_path_stroke_t;
+
+ PathIterator hatch_path(gc.hatchpath);
+ agg::trans_affine hatch_trans;
+ hatch_trans *= agg::trans_affine_scaling(HATCH_SIZE, HATCH_SIZE);
+ hatch_path_trans_t hatch_path_trans(hatch_path, hatch_trans);
+ hatch_path_simplify_t hatch_path_simplify
+ (hatch_path_trans, true, false, HATCH_SIZE, HATCH_SIZE);
+ hatch_path_stroke_t hatch_path_stroke(hatch_path_simplify);
+ hatch_path_stroke.width(1.0);
+ hatch_path_stroke.line_cap(agg::square_cap);
+ theRasterizer.add_path(hatch_path_stroke);
+
+ // Render the path into the hatch buffer
+ pixfmt hatch_img_pixf(hatchRenderingBuffer);
+ renderer_base rb(hatch_img_pixf);
+ renderer_aa rs(rb);
+ rb.clear(agg::rgba(0.0, 0.0, 0.0, 0.0));
+ rs.color(gc.color);
+ agg::render_scanlines(theRasterizer, slineP8, rs);
+
+ // Put clipping back on, if originally set on entry to this
+ // function
+ set_clipbox(gc.cliprect, theRasterizer);
+ if (has_clippath)
+ render_clippath(gc.clippath, gc.clippath_trans);
+
+ // Transfer the hatch to the main image buffer
+ typedef agg::image_accessor_wrap<pixfmt,
+ agg::wrap_mode_repeat_auto_pow2,
+ agg::wrap_mode_repeat_auto_pow2> img_source_type;
+ typedef agg::span_pattern_rgba<img_source_type> span_gen_type;
+ agg::span_allocator<agg::rgba8> sa;
+ img_source_type img_src(hatch_img_pixf);
+ span_gen_type sg(img_src, 0, 0);
+ theRasterizer.add_path(path);
+ agg::render_scanlines_aa(theRasterizer, slineP8, rendererBase, sa, sg);
+ }
+
// Render stroke
if (gc.linewidth != 0.0) {
double linewidth = gc.linewidth;
Modified: trunk/matplotlib/src/_backend_agg.h
===================================================================
--- trunk/matplotlib/src/_backend_agg.h 2008-12-29 13:58:18 UTC (rev 6707)
+++ trunk/matplotlib/src/_backend_agg.h 2008-12-29 14:08:13 UTC (rev 6708)
@@ -60,7 +60,6 @@
typedef agg::scanline_bin scanline_bin;
typedef agg::amask_no_clip_gray8 alpha_mask_type;
-
typedef agg::renderer_base<agg::pixfmt_gray8> renderer_base_alpha_mask_type;
typedef agg::renderer_scanline_aa_solid<renderer_base_alpha_mask_type> renderer_alpha_mask_type;
@@ -129,6 +128,8 @@
SNAP_TRUE
} snap;
+ Py::Object hatchpath;
+
protected:
agg::rgba get_color(const Py::Object& gc);
double points_to_pixels( const Py::Object& points);
@@ -139,6 +140,7 @@
void _set_clip_path( const Py::Object& gc);
void _set_antialiased( const Py::Object& gc);
void _set_snap( const Py::Object& gc);
+ void _set_hatch_path( const Py::Object& gc);
};
@@ -206,6 +208,12 @@
Py::Object lastclippath;
agg::trans_affine lastclippath_transform;
+ // HATCH_SIZE should be a power of 2, to take advantage of Agg's
+ // fast pattern rendering
+ static const size_t HATCH_SIZE = 128;
+ agg::int8u hatchBuffer[HATCH_SIZE * HATCH_SIZE * 4];
+ agg::rendering_buffer hatchRenderingBuffer;
+
const int debug;
protected:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2008-12-29 13:58:28
|
Revision: 6707
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6707&view=rev
Author: jouni
Date: 2008-12-29 13:58:18 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Fix bug in earlier bugfix
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-29 13:48:51 UTC (rev 6706)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-29 13:58:18 UTC (rev 6707)
@@ -528,7 +528,8 @@
# TODO: font effects such as SlantFont
matplotlib.verbose.report(
'Embedding Type 1 font ' + fontinfo.fontfile +
- ' with encoding ' + fontinfo.encodingfile, 'debug')
+ ' with encoding ' + (fontinfo.encodingfile or '(none)'),
+ 'debug')
# Use FT2Font to get several font properties
font = FT2Font(fontinfo.fontfile)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2008-12-29 13:49:02
|
Revision: 6706
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6706&view=rev
Author: jouni
Date: 2008-12-29 13:48:51 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Fix a bug in pdf usetex support
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-12-28 16:07:10 UTC (rev 6705)
+++ trunk/matplotlib/CHANGELOG 2008-12-29 13:48:51 UTC (rev 6706)
@@ -1,3 +1,7 @@
+2008-12-29 Fix a bug in pdf usetex support, which occurred if the same
+ Type-1 font was used with different encodings, e.g. with
+ Minion Pro and MnSymbol. - JKS
+
2008-12-20 fix the dpi-dependent offset of Shadow. - JJL
2008-12-20 fix the hatch bug in the pdf backend. minor update
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-28 16:07:10 UTC (rev 6705)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-29 13:48:51 UTC (rev 6706)
@@ -394,10 +394,11 @@
'Contents': contentObject }
self.writeObject(thePageObject, thePage)
- # self.fontNames maps filenames to internal font names
- self.fontNames = {}
+ self.fontNames = {} # maps filenames to internal font names
self.nextFont = 1 # next free internal font name
- self.fontInfo = {} # information on fonts: metrics, encoding
+ self.dviFontInfo = {} # information on dvi fonts
+ self.type1Descriptors = {} # differently encoded Type-1 fonts may
+ # share the same descriptor
self.alphaStates = {} # maps alpha values to graphics state objects
self.nextAlphaState = 1
@@ -474,7 +475,7 @@
"""
Select a font based on fontprop and return a name suitable for
Op.selectfont. If fontprop is a string, it will be interpreted
- as the filename of the font.
+ as the filename (or dvi name) of the font.
"""
if is_string_like(fontprop):
@@ -496,17 +497,18 @@
fonts = {}
for filename, Fx in self.fontNames.items():
if filename.endswith('.afm'):
+ # from pdf.use14corefonts
fontdictObject = self._write_afm_font(filename)
- elif filename.endswith('.pfb') or filename.endswith('.pfa'):
- # a Type 1 font; limited support for now
- fontdictObject = self.embedType1(filename, self.fontInfo[Fx])
+ elif self.dviFontInfo.has_key(filename):
+ # a Type 1 font from a dvi file
+ fontdictObject = self.embedType1(filename, self.dviFontInfo[filename])
else:
+ # a normal TrueType font
realpath, stat_key = get_realpath_and_stat(filename)
chars = self.used_characters.get(stat_key)
if chars is not None and len(chars[1]):
fontdictObject = self.embedTTF(realpath, chars[1])
fonts[Fx] = fontdictObject
- #print >>sys.stderr, filename
self.writeObject(self.fontObject, fonts)
def _write_afm_font(self, filename):
@@ -522,36 +524,40 @@
self.writeObject(fontdictObject, fontdict)
return fontdictObject
- def embedType1(self, filename, fontinfo):
+ def embedType1(self, texname, fontinfo):
# TODO: font effects such as SlantFont
- fh = open(filename, 'rb')
matplotlib.verbose.report(
- 'Embedding Type 1 font ' + filename, 'debug')
- try:
- fontdata = fh.read()
- finally:
- fh.close()
+ 'Embedding Type 1 font ' + fontinfo.fontfile +
+ ' with encoding ' + fontinfo.encodingfile, 'debug')
- font = FT2Font(filename)
+ # Use FT2Font to get several font properties
+ font = FT2Font(fontinfo.fontfile)
- widthsObject, fontdescObject, fontdictObject, fontfileObject = \
- [ self.reserveObject(n) for n in
- ('font widths', 'font descriptor',
- 'font dictionary', 'font file') ]
+ # Font descriptors may be shared between differently encoded
+ # Type-1 fonts, so only create a new descriptor if there is no
+ # existing descriptor for this font.
+ fontdesc = self.type1Descriptors.get(fontinfo.fontfile)
+ if fontdesc is None:
+ fontdesc = self.createType1Descriptor(font, fontinfo.fontfile)
+ self.type1Descriptors[fontinfo.fontfile] = fontdesc
- firstchar = 0
- lastchar = len(fontinfo.widths) - 1
+ # Widths
+ widthsObject = self.reserveObject('font widths')
+ self.writeObject(widthsObject, fontinfo.widths)
+ # Font dictionary
+ fontdictObject = self.reserveObject('font dictionary')
fontdict = {
'Type': Name('Font'),
'Subtype': Name('Type1'),
'BaseFont': Name(font.postscript_name),
'FirstChar': 0,
- 'LastChar': lastchar,
+ 'LastChar': len(fontinfo.widths) - 1,
'Widths': widthsObject,
- 'FontDescriptor': fontdescObject,
+ 'FontDescriptor': fontdesc,
}
+ # Encoding (if needed)
if fontinfo.encodingfile is not None:
enc = dviread.Encoding(fontinfo.encodingfile)
differencesArray = [ Name(ch) for ch in enc ]
@@ -561,6 +567,15 @@
'Differences': differencesArray },
})
+ self.writeObject(fontdictObject, fontdict)
+ return fontdictObject
+
+ def createType1Descriptor(self, font, fontfile):
+ # Create and write the font descriptor and the font file
+ # of a Type-1 font
+ fontdescObject = self.reserveObject('font descriptor')
+ fontfileObject = self.reserveObject('font file')
+
_, _, fullname, familyname, weight, italic_angle, fixed_pitch, \
ul_position, ul_thickness = font.get_ps_font_info()
@@ -591,11 +606,9 @@
#'FontWeight': a number where 400 = Regular, 700 = Bold
}
- self.writeObject(fontdictObject, fontdict)
- self.writeObject(widthsObject, fontinfo.widths)
self.writeObject(fontdescObject, descriptor)
- t1font = type1font.Type1Font(filename)
+ t1font = type1font.Type1Font(fontfile)
self.beginStream(fontfileObject.id, None,
{ 'Length1': len(t1font.parts[0]),
'Length2': len(t1font.parts[1]),
@@ -604,7 +617,7 @@
self.currentstream.write(t1font.parts[1])
self.endStream()
- return fontdictObject
+ return fontdescObject
def _get_xobject_symbol_name(self, filename, symbol_name):
return "%s-%s" % (
@@ -1362,13 +1375,15 @@
oldfont, seq = None, []
for x1, y1, dvifont, glyph, width in page.text:
if dvifont != oldfont:
- psfont = self.tex_font_mapping(dvifont.texname)
- pdfname = self.file.fontName(psfont.filename)
- if self.file.fontInfo.get(pdfname, None) is None:
- self.file.fontInfo[pdfname] = Bunch(
+ pdfname = self.file.fontName(dvifont.texname)
+ if not self.file.dviFontInfo.has_key(dvifont.texname):
+ psfont = self.tex_font_mapping(dvifont.texname)
+ self.file.dviFontInfo[dvifont.texname] = Bunch(
+ fontfile=psfont.filename,
encodingfile=psfont.encoding,
widths=dvifont.widths,
dvifont=dvifont)
+ # TODO: font effects
seq += [['font', pdfname, dvifont.size]]
oldfont = dvifont
seq += [['text', x1, y1, [chr(glyph)], x1+width]]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-12-28 16:07:13
|
Revision: 6705
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6705&view=rev
Author: jswhit
Date: 2008-12-28 16:07:10 +0000 (Sun, 28 Dec 2008)
Log Message:
-----------
simplify calculation of geostationary limb
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008-12-26 23:20:56 UTC (rev 6704)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008-12-28 16:07:10 UTC (rev 6705)
@@ -94,20 +94,21 @@
elif self.projection == 'geos':
self._proj4 = pyproj.Proj(projparams)
# find major and minor axes of ellipse defining map proj region.
- delta = 0.01
- lats = np.arange(0,90,delta)
- lon_0 = projparams['lon_0']
- lons = lon_0*np.ones(len(lats),'d')
- x, y = self._proj4(lons, lats)
- yi = (y > 1.e20).tolist()
- ny = yi.index(1)-1
- height = y[ny]
- lons = np.arange(lon_0,lon_0+90,delta)
- lats = np.zeros(len(lons),'d')
- x, y = self(lons, lats)
- xi = (x > 1.e20).tolist()
- nx = xi.index(1)-1
- width = x[nx]
+ # h is measured from surface of earth at equator.
+ h = projparams['h'] + self.rmajor
+ # latitude of horizon on central meridian
+ lonmax = 90.-(180./np.pi)*np.arcsin(self.rmajor/h)
+ # longitude of horizon on equator
+ latmax = 90.-(180./np.pi)*np.arcsin(self.rminor/h)
+ # truncate to nearest hundredth of a degree (to make sure
+ # they aren't slightly over the horizon)
+ latmax = int(100*latmax)/100.
+ lonmax = int(100*lonmax)/100.
+ # width and height of visible projection
+ P = pyproj.Proj(proj='geos',a=self.rmajor,\
+ b=self.rminor,lat_0=0,lon_0=0,h=projparams['h'])
+ x1,y1 = P(0.,latmax); x2,y2 = P(lonmax,0.)
+ width = x2; height = y1
self._height = height
self._width = width
if (llcrnrlon == -180 and llcrnrlat == -90 and
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-12-26 23:21:00
|
Revision: 6704
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6704&view=rev
Author: jswhit
Date: 2008-12-26 23:20:56 +0000 (Fri, 26 Dec 2008)
Log Message:
-----------
fix defn of llcrnrlon, urcrnrlon for pseudo-cyl projections
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-26 16:36:39 UTC (rev 6703)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-26 23:20:56 UTC (rev 6704)
@@ -594,9 +594,9 @@
raise ValueError, 'must specify lon_0 for %s projection' % _projnames[self.projection]
if width is not None or height is not None:
print 'warning: width and height keywords ignored for %s projection' % _projnames[self.projection]
- llcrnrlon = -180.
+ llcrnrlon = lon_0-180.
llcrnrlat = -90.
- urcrnrlon = 180
+ urcrnrlon = lon_0+180
urcrnrlat = 90.
self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-26 16:36:43
|
Revision: 6703
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6703&view=rev
Author: mdboom
Date: 2008-12-26 16:36:39 +0000 (Fri, 26 Dec 2008)
Log Message:
-----------
Document \mathdefault{} and \mathregular{} and the new mathtext.default rcParam.
Modified Paths:
--------------
trunk/matplotlib/doc/users/mathtext.rst
Modified: trunk/matplotlib/doc/users/mathtext.rst
===================================================================
--- trunk/matplotlib/doc/users/mathtext.rst 2008-12-26 16:28:04 UTC (rev 6702)
+++ trunk/matplotlib/doc/users/mathtext.rst 2008-12-26 16:36:39 UTC (rev 6703)
@@ -144,10 +144,17 @@
Fonts
-----
-The default font is *italics* for mathematical symbols. To change
-fonts, eg, to write "sin" in a Roman font, enclose the text in a font
-command::
+The default font is *italics* for mathematical symbols.
+.. note::
+
+ This default can be changed using the ``mathtext.default`` rcParam.
+ This is useful, for example, to use the same font as regular
+ non-math text for math text, by setting it to ``regular``.
+
+To change fonts, eg, to write "sin" in a Roman font, enclose the text
+in a font command::
+
r'$s(t) = \mathcal{A}\mathrm{sin}(2 \omega t)$'
.. math::
@@ -223,6 +230,12 @@
.. image:: ../_static/stixsans_fontset.png
+Additionally, you can use ``\mathdefault{...}`` or its alias
+``\mathregular{...}`` to use the font used for regular text outside of
+mathtext. There are a number of limitations to this approach, most
+notably that far fewer symbols will be available, but it can be useful
+to make math expressions blend well with other text in the plot.
+
Custom fonts
~~~~~~~~~~~~
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-26 16:28:07
|
Revision: 6702
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6702&view=rev
Author: mdboom
Date: 2008-12-26 16:28:04 +0000 (Fri, 26 Dec 2008)
Log Message:
-----------
Merge branch 'mathdefault'
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/config/mplconfig.py
trunk/matplotlib/lib/matplotlib/config/rcsetup.py
trunk/matplotlib/lib/matplotlib/mathtext.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-12-23 21:55:45 UTC (rev 6701)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-12-26 16:28:04 UTC (rev 6702)
@@ -168,6 +168,7 @@
bf = T.Trait('serif:bold' , mplT.FontconfigPatternHandler())
sf = T.Trait('sans' , mplT.FontconfigPatternHandler())
fontset = T.Trait('cm', 'cm', 'stix', 'stixsans', 'custom')
+ default = T.Trait(*("rm cal it tt sf bf default bb frak circled scr regular".split()))
fallback_to_cm = T.true
class axes(TConfig):
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-12-23 21:55:45 UTC (rev 6701)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-12-26 16:28:04 UTC (rev 6702)
@@ -209,6 +209,9 @@
validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'stixsans', 'custom'])
+validate_mathtext_default = ValidateInStrings(
+ 'default', "rm cal it tt sf bf default bb frak circled scr regular".split())
+
validate_verbose = ValidateInStrings('verbose',[
'silent', 'helpful', 'debug', 'debug-annoying',
])
@@ -371,6 +374,7 @@
'mathtext.bf' : ['serif:bold', validate_font_properties],
'mathtext.sf' : ['sans\-serif', validate_font_properties],
'mathtext.fontset' : ['cm', validate_fontset],
+ 'mathtext.default' : ['it', validate_mathtext_default],
'mathtext.fallback_to_cm' : [True, validate_bool],
'image.aspect' : ['equal', validate_aspect], # equal, auto, a number
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-12-23 21:55:45 UTC (rev 6701)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-12-26 16:28:04 UTC (rev 6702)
@@ -403,7 +403,7 @@
*fontX*: one of the TeX font names::
- tt, it, rm, cal, sf, bf or default (non-math)
+ tt, it, rm, cal, sf, bf or default/regular (non-math)
*fontclassX*: TODO
@@ -419,7 +419,7 @@
"""
*font*: one of the TeX font names::
- tt, it, rm, cal, sf, bf or default (non-math)
+ tt, it, rm, cal, sf, bf or default/regular (non-math)
*font_class*: TODO
@@ -543,6 +543,7 @@
filename = findfont(default_font_prop)
default_font = self.CachedFont(FT2Font(str(filename)))
self._fonts['default'] = default_font
+ self._fonts['regular'] = default_font
def destroy(self):
self.glyphd = None
@@ -616,7 +617,7 @@
pclt = cached_font.font.get_sfnt_table('pclt')
if pclt is None:
# Some fonts don't store the xHeight, so we do a poor man's xHeight
- metrics = self.get_metrics(font, 'it', 'x', fontsize, dpi)
+ metrics = self.get_metrics(font, rcParams['mathtext.default'], 'x', fontsize, dpi)
return metrics.iceberg
xHeight = (pclt['xHeight'] / 64.0) * (fontsize / 12.0) * (dpi / 100.0)
return xHeight
@@ -936,7 +937,7 @@
elif not doing_sans_conversion:
# This will generate a dummy character
uniindex = 0x1
- fontname = 'it'
+ fontname = rcParams['mathtext.default']
# Handle private use area glyphs
if (fontname in ('it', 'rm', 'bf') and
@@ -1007,6 +1008,7 @@
default_font.fname = filename
self.fonts['default'] = default_font
+ self.fonts['regular'] = default_font
self.pswriter = StringIO()
def _get_font(self, font):
@@ -2064,7 +2066,7 @@
_dropsub_symbols = set(r'''\int \oint'''.split())
- _fontnames = set("rm cal it tt sf bf default bb frak circled scr".split())
+ _fontnames = set("rm cal it tt sf bf default bb frak circled scr regular".split())
_function_names = set("""
arccos csc ker min arcsin deg lg Pr arctan det lim sec arg dim
@@ -2294,7 +2296,7 @@
def _get_font(self):
return self._font
def _set_font(self, name):
- if name in ('it', 'rm', 'bf'):
+ if name in Parser._fontnames:
self.font_class = name
self._font = name
font = property(_get_font, _set_font)
@@ -2336,7 +2338,7 @@
hlist = Hlist(symbols)
# We're going into math now, so set font to 'it'
self.push_state()
- self.get_state().font = 'it'
+ self.get_state().font = rcParams['mathtext.default']
return [hlist]
def _make_space(self, percentage):
@@ -2346,7 +2348,7 @@
width = self._em_width_cache.get(key)
if width is None:
metrics = state.font_output.get_metrics(
- state.font, 'it', 'm', state.fontsize, state.dpi)
+ state.font, rcParams['mathtext.default'], 'm', state.fontsize, state.dpi)
width = metrics.advance
self._em_width_cache[key] = width
return Kern(width * percentage)
@@ -2665,7 +2667,7 @@
# Shift so the fraction line sits in the middle of the
# equals sign
metrics = state.font_output.get_metrics(
- state.font, 'it', '=', state.fontsize, state.dpi)
+ state.font, rcParams['mathtext.default'], '=', state.fontsize, state.dpi)
shift = (cden.height -
((metrics.ymax + metrics.ymin) / 2 -
thickness * 3.0))
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-12-23 21:55:45 UTC (rev 6701)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-12-26 16:28:04 UTC (rev 6702)
@@ -233,6 +233,9 @@
validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'stixsans', 'custom'])
+validate_mathtext_default = ValidateInStrings(
+ 'default', "rm cal it tt sf bf default bb frak circled scr regular".split())
+
validate_verbose = ValidateInStrings('verbose',[
'silent', 'helpful', 'debug', 'debug-annoying',
])
@@ -397,6 +400,7 @@
'mathtext.bf' : ['serif:bold', validate_font_properties],
'mathtext.sf' : ['sans\-serif', validate_font_properties],
'mathtext.fontset' : ['cm', validate_fontset],
+ 'mathtext.default' : ['it', validate_mathtext_default],
'mathtext.fallback_to_cm' : [True, validate_bool],
'image.aspect' : ['equal', validate_aspect], # equal, auto, a number
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template 2008-12-23 21:55:45 UTC (rev 6701)
+++ trunk/matplotlib/matplotlibrc.template 2008-12-26 16:28:04 UTC (rev 6702)
@@ -185,6 +185,11 @@
# fonts when a symbol can not be found in one of
# the custom math fonts.
+#mathtext.default : it # The default font to use for math.
+ # Can be any of the LaTeX font names, including
+ # the special name "regular" for the same font
+ # used in regular text.
+
### AXES
# default face and edge color, default tick sizes,
# default fontsizes for ticklabels, and so on. See
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-23 23:17:26
|
Revision: 6701
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6701&view=rev
Author: jdh2358
Date: 2008-12-23 21:55:45 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
fixed a mincnt problem with hexbin
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:54:17 UTC (rev 6700)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 21:55:45 UTC (rev 6701)
@@ -5417,7 +5417,7 @@
for i in xrange(nx2):
for j in xrange(ny2):
vals = lattice2[i,j]
- if len(vals):
+ if len(vals)>mincnt:
lattice2[i,j] = reduce_C_function( vals )
else:
lattice2[i,j] = np.nan
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-23 19:54:22
|
Revision: 6700
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6700&view=rev
Author: jdh2358
Date: 2008-12-23 19:54:17 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
added support for mincnt to hexbin
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:49:08 UTC (rev 6699)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:54:17 UTC (rev 6700)
@@ -5270,7 +5270,7 @@
Use a linear or log10 scale on the vertical axis.
*mincnt*: None | a positive integer
- If not None, only display cells with at least *mincnt*
+ If not None, only display cells with more than *mincnt*
number of points in the cell
Other keyword arguments controlling color mapping and normalization
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-23 19:49:18
|
Revision: 6699
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6699&view=rev
Author: jdh2358
Date: 2008-12-23 19:49:08 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
added support for mincnt to hexbin
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/release/osx/Makefile
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 16:06:15 UTC (rev 6698)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:49:08 UTC (rev 6699)
@@ -5212,7 +5212,7 @@
xscale = 'linear', yscale = 'linear',
cmap=None, norm=None, vmin=None, vmax=None,
alpha=1.0, linewidths=None, edgecolors='none',
- reduce_C_function = np.mean,
+ reduce_C_function = np.mean, mincnt=None,
**kwargs):
"""
call signature::
@@ -5221,7 +5221,7 @@
xscale = 'linear', yscale = 'linear',
cmap=None, norm=None, vmin=None, vmax=None,
alpha=1.0, linewidths=None, edgecolors='none'
- reduce_C_function = np.mean,
+ reduce_C_function = np.mean, mincnt=None,
**kwargs)
Make a hexagonal binning plot of *x* versus *y*, where *x*,
@@ -5269,6 +5269,10 @@
*scale*: [ 'linear' | 'log' ]
Use a linear or log10 scale on the vertical axis.
+ *mincnt*: None | a positive integer
+ If not None, only display cells with at least *mincnt*
+ number of points in the cell
+
Other keyword arguments controlling color mapping and normalization
arguments:
@@ -5369,6 +5373,8 @@
d1 = (x-ix1)**2 + 3.0 * (y-iy1)**2
d2 = (x-ix2-0.5)**2 + 3.0 * (y-iy2-0.5)**2
bdist = (d1<d2)
+ if mincnt is None:
+ mincnt = 0
if C is None:
accum = np.zeros(n)
@@ -5400,10 +5406,11 @@
else:
lattice2[ix2[i], iy2[i]].append( C[i] )
+
for i in xrange(nx1):
for j in xrange(ny1):
vals = lattice1[i,j]
- if len(vals):
+ if len(vals)>mincnt:
lattice1[i,j] = reduce_C_function( vals )
else:
lattice1[i,j] = np.nan
Modified: trunk/matplotlib/release/osx/Makefile
===================================================================
--- trunk/matplotlib/release/osx/Makefile 2008-12-23 16:06:15 UTC (rev 6698)
+++ trunk/matplotlib/release/osx/Makefile 2008-12-23 19:49:08 UTC (rev 6699)
@@ -95,7 +95,7 @@
rm -rf upload &&\
mkdir upload &&\
cp matplotlib-${MPLVERSION}.tar.gz upload/ &&\
- cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}_r0-py2.5-macosx-10.3-fat.egg upload/matplotlib-${MPLVERSION}-py2.5.egg &&\
+ cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}_r0-py2.5-macosx-10.3-fat.egg upload/matplotlib-${MPLVERSION}-macosx-py2.5.egg &&\
cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}-py2.5-macosx10.5.zip upload/matplotlib-${MPLVERSION}-py2.5-mpkg.zip&&\
scp upload/* jd...@fr...:uploads/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-23 16:06:19
|
Revision: 6698
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6698&view=rev
Author: jdh2358
Date: 2008-12-23 16:06:15 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
fixed a bug in the nsorted changes
Modified Paths:
--------------
trunk/py4science/examples/pyrex/trailstats/ringbufnan.c
Modified: trunk/py4science/examples/pyrex/trailstats/ringbufnan.c
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/ringbufnan.c 2008-12-23 01:06:18 UTC (rev 6697)
+++ trunk/py4science/examples/pyrex/trailstats/ringbufnan.c 2008-12-23 16:06:15 UTC (rev 6698)
@@ -376,7 +376,7 @@
rb_ptr = new_ringbuf(nrb);
for (i = 0; i < npad; i++)
{
- nsorted[j*step] = ringbuf_add(rb_ptr, data[i*step]);
+ nsorted[i*step] = ringbuf_add(rb_ptr, data[i*step]);
}
for (j=0; j<nd; i++, j++)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-23 01:06:21
|
Revision: 6697
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6697&view=rev
Author: ryanmay
Date: 2008-12-23 01:06:18 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
Fix typo.
Modified Paths:
--------------
trunk/toolkits/basemap/doc/users/installing.rst
Modified: trunk/toolkits/basemap/doc/users/installing.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 21:24:21 UTC (rev 6696)
+++ trunk/toolkits/basemap/doc/users/installing.rst 2008-12-23 01:06:18 UTC (rev 6697)
@@ -36,7 +36,7 @@
C library with python interface for reading ESRI shapefiles.
If not present, will be installed with basemap.
-`pupnyere <http://pypi.python.org/pypi/pupynere/>`__
+`pupynere <http://pypi.python.org/pypi/pupynere/>`__
Pure python `netCDF <http://www.unidata.ucar.edu/software/netcdf/>`__
reader. Patched version automatically installed with basemap.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-22 21:24:25
|
Revision: 6696
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6696&view=rev
Author: jdh2358
Date: 2008-12-22 21:24:21 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
default to draw_idle in draw_if_interactive if it is supported
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-22 20:13:24 UTC (rev 6695)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-22 21:24:21 UTC (rev 6696)
@@ -60,7 +60,7 @@
if matplotlib.is_interactive():
figManager = Gcf.get_active()
if figManager is not None:
- figManager.canvas.draw()
+ figManager.canvas.draw_idle()
def show(mainloop=True):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-12-22 20:13:24 UTC (rev 6695)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-12-22 21:24:21 UTC (rev 6696)
@@ -389,7 +389,7 @@
# anim.py requires this
if sys.platform=='win32' : self.window.update()
else:
- self.canvas.draw()
+ self.canvas.draw_idle()
self._shown = True
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-22 20:13:24 UTC (rev 6695)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-22 21:24:21 UTC (rev 6696)
@@ -1306,7 +1306,7 @@
figManager = Gcf.get_active()
if figManager is not None:
- figManager.canvas.draw()
+ figManager.canvas.draw_idle()
def show():
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-12-22 20:13:30
|
Revision: 6695
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6695&view=rev
Author: jswhit
Date: 2008-12-22 20:13:24 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
fix another typo
Modified Paths:
--------------
trunk/toolkits/basemap/doc/users/installing.rst
Modified: trunk/toolkits/basemap/doc/users/installing.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 20:06:24 UTC (rev 6694)
+++ trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 20:13:24 UTC (rev 6695)
@@ -38,7 +38,7 @@
`pupnyere <http://pypi.python.org/pypi/pupynere/>`__
Pure python `netCDF <http://www.unidata.ucar.edu/software/netcdf/>`__
- netCDF reader. Patched version automatically installed with basemap.
+ reader. Patched version automatically installed with basemap.
`pydap <http://code.google.com/p/pydap>`__
Pure python `OPeNDAP <http://opendap.org>`__ implementation.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-12-22 20:06:29
|
Revision: 6694
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6694&view=rev
Author: jswhit
Date: 2008-12-22 20:06:24 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
use default css, fix typo in installation guide.
Modified Paths:
--------------
trunk/toolkits/basemap/doc/conf.py
trunk/toolkits/basemap/doc/users/installing.rst
Modified: trunk/toolkits/basemap/doc/conf.py
===================================================================
--- trunk/toolkits/basemap/doc/conf.py 2008-12-22 19:42:46 UTC (rev 6693)
+++ trunk/toolkits/basemap/doc/conf.py 2008-12-22 20:06:24 UTC (rev 6694)
@@ -80,7 +80,7 @@
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
-html_style = 'matplotlib.css'
+#html_style = 'mpl.css'
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
Modified: trunk/toolkits/basemap/doc/users/installing.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 19:42:46 UTC (rev 6693)
+++ trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 20:06:24 UTC (rev 6694)
@@ -38,7 +38,7 @@
`pupnyere <http://pypi.python.org/pypi/pupynere/>`__
Pure python `netCDF <http://www.unidata.ucar.edu/software/netcdf/>`__
- patched version automatically installed with basemap.
+ netCDF reader. Patched version automatically installed with basemap.
`pydap <http://code.google.com/p/pydap>`__
Pure python `OPeNDAP <http://opendap.org>`__ implementation.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-12-22 19:42:53
|
Revision: 6693
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6693&view=rev
Author: jswhit
Date: 2008-12-22 19:42:46 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
update install instructions.
Modified Paths:
--------------
trunk/toolkits/basemap/doc/users/installing.rst
Modified: trunk/toolkits/basemap/doc/users/installing.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 16:50:12 UTC (rev 6692)
+++ trunk/toolkits/basemap/doc/users/installing.rst 2008-12-22 19:42:46 UTC (rev 6693)
@@ -33,12 +33,12 @@
Patched version automatically built into basemap.
`pyshapelib <http://intevation.de/pipermail/thuban-devel/2004-May/000184.html>`__
- C library with python interface for reading ESRI shapefiles (automatically
- built and installed with basemap).
+ C library with python interface for reading ESRI shapefiles.
+ If not present, will be installed with basemap.
`pupnyere <http://pypi.python.org/pypi/pupynere/>`__
Pure python `netCDF <http://www.unidata.ucar.edu/software/netcdf/>`__
- interface automatically installed with basemap.
+ patched version automatically installed with basemap.
`pydap <http://code.google.com/p/pydap>`__
Pure python `OPeNDAP <http://opendap.org>`__ implementation.
@@ -87,11 +87,11 @@
by running ``from mpl_toolkits.basemap import Basemap`` at the python
prompt.
- Basemap includes two auxilliary packages, pydap and httplib2.
+ Basemap includes three auxilliary packages, pydap, pyshapelib httplib2.
By default, setup.py checks to
see if these are already installed, and if so does not try to overwrite
- them. If you get import errors related to either of these two packages,
- edit setup.cfg and set pydap and/or httplib2 to True to force
+ them. If you get import errors related to any of these packages,
+ edit setup.cfg and set the appropriate entry to True to force
installation of the included versions.
* To test, cd to the examples directory and run ``python simpletest.py``.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-22 16:50:15
|
Revision: 6692
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6692&view=rev
Author: jdh2358
Date: 2008-12-22 16:50:12 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
added nsorted attr
Modified Paths:
--------------
trunk/py4science/examples/pyrex/trailstats/c_ringbuf.pxi
trunk/py4science/examples/pyrex/trailstats/movavg_fast.py
trunk/py4science/examples/pyrex/trailstats/movavg_ringbuf.py
trunk/py4science/examples/pyrex/trailstats/ringbuf.h
trunk/py4science/examples/pyrex/trailstats/ringbuf.pyx
trunk/py4science/examples/pyrex/trailstats/ringbuf_demo.py
trunk/py4science/examples/pyrex/trailstats/ringbufnan.c
Modified: trunk/py4science/examples/pyrex/trailstats/c_ringbuf.pxi
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/c_ringbuf.pxi 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/c_ringbuf.pxi 2008-12-22 16:50:12 UTC (rev 6692)
@@ -13,7 +13,7 @@
ringbuf_t *new_ringbuf(int N)
void zero_ringbuf(ringbuf_t *rb_ptr)
void delete_ringbuf(ringbuf_t *rb_ptr)
- void ringbuf_add(ringbuf_t *rb_ptr, double d)
+ int ringbuf_add(ringbuf_t *rb_ptr, double d)
double ringbuf_getitem(ringbuf_t *rb_ptr, int i)
double ringbuf_min(ringbuf_t *rb_ptr)
double ringbuf_max(ringbuf_t *rb_ptr)
@@ -29,12 +29,12 @@
double *dstd,
double *dmin,
double *dmax,
- double *dmed,
- double *dptile5,
- double *dptile95,
+ double *dmed,
+ double *dptile5,
+ double *dptile95,
+ int *nsorted,
int *ng)
void c_runstats2(int nrb, int nd, int step, int ofs,
double *data, double *dmean, double *dstd,
- double *dmin, double *dmax, double *dmed, double *dptile5,
- double *dptile95, int *ng)
-
+ double *dmin, double *dmax, double *dmed, double *dptile5,
+ double *dptile95, int *nsorted, int *ng)
Modified: trunk/py4science/examples/pyrex/trailstats/movavg_fast.py
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/movavg_fast.py 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/movavg_fast.py 2008-12-22 16:50:12 UTC (rev 6692)
@@ -5,10 +5,10 @@
import ringbuf
x = numpy.random.rand(10000)
-dmean, dstd, dmin, dmax, dmedian, ptile5, ptile95, ng = ringbuf.runstats(x, 30)
+dmean, dstd, dmin, dmax, dmedian, ptile5, ptile95, nsorted, ng = ringbuf.runstats(x, 30)
r = numpy.rec.fromarrays([dmean, dstd, dmin, dmax, dmedian, ng],
- names='dmean,dstd,dmin,dmax,dmedian,ptile5,ptile95,ngood')
+ names='dmean,dstd,dmin,dmax,dmedian,ptile5,ptile95,nsorted,ngood')
Modified: trunk/py4science/examples/pyrex/trailstats/movavg_ringbuf.py
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/movavg_ringbuf.py 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/movavg_ringbuf.py 2008-12-22 16:50:12 UTC (rev 6692)
@@ -9,8 +9,8 @@
data = []
for thisx in x:
- r.add(thisx)
- data.append([thisx, r.N_good(), r.min(), r.max(), r.mean(), r.sd()])
+ nsorted = r.add(thisx)
+ data.append([thisx, r.N_good(), nsorted,r.min(), r.max(), r.mean(), r.sd()])
-r = numpy.rec.fromarrays(data,names='x,ngood,min30,max30,mean30,sd30')
+r = numpy.rec.fromarrays(data,names='x,ngood,nsorted,min30,max30,mean30,sd30')
Modified: trunk/py4science/examples/pyrex/trailstats/ringbuf.h
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/ringbuf.h 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/ringbuf.h 2008-12-22 16:50:12 UTC (rev 6692)
@@ -21,7 +21,7 @@
int ringbuf_slice_i(ringbuf_t *rb_ptr, int i);
double ringbuf_getitem(ringbuf_t *rb_ptr, int i);
-void ringbuf_add(ringbuf_t *rb_ptr, double d);
+int ringbuf_add(ringbuf_t *rb_ptr, double d);
double ringbuf_min(ringbuf_t *rb_ptr);
double ringbuf_max(ringbuf_t *rb_ptr);
double ringbuf_median(ringbuf_t *rb_ptr);
@@ -33,10 +33,10 @@
double ringbuf_sd(ringbuf_t *rb_ptr);
void c_runstats(int nrb, int nd, double *data, double *dmean, double *dstd,
- double *dmin, double *dmax, double *dmed, double *dptile5, double *dptile95, int *ng);
+ double *dmin, double *dmax, double *dmed, double *dptile5, double *dptile95, int *nsorted, int *ng);
void c_runstats2(int nrb, int nd, int step, int ofs,
double *data, double *dmean, double *dstd,
- double *dmin, double *dmax, double *dmed, double *dptile5, double *dptile95, int *ng);
+ double *dmin, double *dmax, double *dmed, double *dptile5, double *dptile95, int *nsorted, int *ng);
Modified: trunk/py4science/examples/pyrex/trailstats/ringbuf.pyx
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/ringbuf.pyx 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/ringbuf.pyx 2008-12-22 16:50:12 UTC (rev 6692)
@@ -46,7 +46,7 @@
zero_ringbuf(self.rb_ptr)
def add(self, d):
- ringbuf_add(self.rb_ptr, d)
+ return ringbuf_add(self.rb_ptr, d)
def min(self):
return ringbuf_min(self.rb_ptr)
@@ -113,10 +113,11 @@
self.records = []
def add(self, d, r):
- ringbuf_add(self.rb_ptr, d)
+ ret = ringbuf_add(self.rb_ptr, d)
self.records.append(r)
if len(self.records) > self.rb_ptr.N_size:
del self.records[0]
+ return ret
def min(self):
return ringbuf_min(self.rb_ptr)
@@ -170,8 +171,10 @@
cdef c_numpy.ndarray c_dmedian
cdef c_numpy.ndarray c_dptile5
cdef c_numpy.ndarray c_dptile95
+ cdef c_numpy.ndarray c_nsorted
cdef c_numpy.ndarray c_ng
+
# make sure that the input array is a 1D numpy array of floats.
# asarray is used to copy and cast a python sequence or array to
# the approriate type, with the advantage that if the data is
@@ -193,6 +196,7 @@
dmedian = numpy.empty_like(data)
dptile5 = numpy.empty_like(data)
dptile95 = numpy.empty_like(data)
+ nsorted = numpy.empty(data.shape, dtype=numpy.int_)
ng = numpy.empty(data.shape, dtype=numpy.int_)
# now we have to assign the c_data structures and friends to their
@@ -205,8 +209,10 @@
c_dmedian = dmedian
c_dptile5 = dptile5
c_dptile95 = dptile95
+ c_nsorted = nsorted
c_ng = ng
+
# now we call the function and pass in the c data pointers to the
# arrays. The syntax <double *>c_data.data tells pyrex to pass
# the numpy data memory block as a pointer to a float array.
@@ -218,7 +224,8 @@
<double *>c_dmedian.data,
<double *>c_dptile5.data,
<double *>c_dptile95.data,
+ <int *>c_nsorted.data,
<int *>c_ng.data)
# all done, return the arrays
- return dmean, dstd, dmin, dmax, dmedian, dptile5, dptile95, ng
+ return dmean, dstd, dmin, dmax, dmedian, dptile5, dptile95, nsorted, ng
Modified: trunk/py4science/examples/pyrex/trailstats/ringbuf_demo.py
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/ringbuf_demo.py 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/ringbuf_demo.py 2008-12-22 16:50:12 UTC (rev 6692)
@@ -1,14 +1,17 @@
"""
Example code showin how to use the ringbuf extension code from python
"""
+import numpy as np
import random
import ringbuf
r = ringbuf.Ringbuf(30)
for i in range(100):
- r.add(random.random())
- print 'Nadded=%d, Ngood=%d, min=%1.2f, max=%1.2f, mean=%1.2f, std=%1.2f'%(
- r.N_added(), r.N_good(), r.min(), r.max(), r.mean(), r.sd())
+ val = random.random()
+ indsorted = r.add(val)
+ ng = r.N_good()
+ percentile = indsorted/float(ng)
+ print 'val=%1.4f, Nadded=%d, Ngood=%d, Nsorted=%d, percentile=%1.4f, min=%1.2f, max=%1.2f, mean=%1.2f, std=%1.2f'%(val, r.N_added(), r.N_good(), indsorted, percentile, r.min(), r.max(), r.mean(), r.sd())
print 'slice', r[:10]
Modified: trunk/py4science/examples/pyrex/trailstats/ringbufnan.c
===================================================================
--- trunk/py4science/examples/pyrex/trailstats/ringbufnan.c 2008-12-22 16:16:58 UTC (rev 6691)
+++ trunk/py4science/examples/pyrex/trailstats/ringbufnan.c 2008-12-22 16:50:12 UTC (rev 6692)
@@ -20,7 +20,7 @@
static double NaN = 0.0;
-static void sort_ringbuf(ringbuf_t *rb_ptr);
+static int sort_ringbuf(ringbuf_t *rb_ptr);
static void resum_ringbuf(ringbuf_t *rb_ptr);
ringbuf_t *new_ringbuf(int N)
@@ -110,19 +110,21 @@
}
}
-void ringbuf_add(ringbuf_t *rb_ptr, double d)
+// return the index into the sorted ring buffer, -1 if no good points
+int ringbuf_add(ringbuf_t *rb_ptr, double d)
{
double d_old;
- int i, i_new, good_new, N;
+ int i, i_new, good_new, N, indsorted;
+ indsorted = -1;
N = rb_ptr->N_size; /* We need this many times. */
i_new = rb_ptr->i_next;
/* Save the old value; otherwise, it will be overwritten. */
d_old = rb_ptr->data[rb_ptr->i_oldest];
rb_ptr->data[i_new] = d;
good_new = !isnan(d);
-#if 1
+#if 0
printf("new value: %lf good_new: %d\n", d, good_new);
printf("i_next: %d i_oldest: %d N_filled: %d N_good: %d\n",
rb_ptr->i_next, rb_ptr->i_oldest,
@@ -174,7 +176,7 @@
{
rb_ptr->sum += d;
rb_ptr->sumsq += d*d;
- sort_ringbuf(rb_ptr);
+ indsorted = sort_ringbuf(rb_ptr);
}
/* To prevent accumulation of truncation error, we
recalculate the sums periodically.
@@ -184,11 +186,12 @@
{
resum_ringbuf(rb_ptr);
}
-#if 1
+#if 0
printf("i_next: %d i_oldest: %d N_filled: %d N_good: %d\n",
rb_ptr->i_next, rb_ptr->i_oldest,
rb_ptr->N_filled, rb_ptr->N_good);
#endif
+ return indsorted;
}
/* This is not a full sort--it assumes the list is
@@ -196,7 +199,7 @@
pass of bubble sorting to put that entry in its place.
The code could be moved bodily into the function above.
*/
-void sort_ringbuf(ringbuf_t *rb_ptr)
+int sort_ringbuf(ringbuf_t *rb_ptr)
{
int i, i_hold;
int *ip;
@@ -218,6 +221,7 @@
break;
}
}
+ return i;
}
double ringbuf_min(ringbuf_t *rb_ptr)
@@ -325,7 +329,7 @@
}
void c_runstats(int nrb, int nd, double *data, double *dmean, double *dstd,
- double *dmin, double *dmax, double *dmed, double *dptile5, double *dptile95, int *ng)
+ double *dmin, double *dmax, double *dmed, double *dptile5, double *dptile95, int *nsorted, int *ng)
{
int i, j;
ringbuf_t *rb_ptr;
@@ -334,7 +338,7 @@
for (j=0; j<nd; i++, j++)
{
- ringbuf_add(rb_ptr, data[j]);
+ nsorted[j] = ringbuf_add(rb_ptr, data[j]);
dmean[j] = ringbuf_mean(rb_ptr);
dstd[j] = ringbuf_sd(rb_ptr);
dmin[j] = ringbuf_min(rb_ptr);
@@ -342,6 +346,7 @@
dmed[j] = ringbuf_median(rb_ptr);
dptile5[j] = ringbuf_ptile(rb_ptr, 0.05);
dptile95[j] = ringbuf_ptile(rb_ptr, 0.95);
+
ng[j] = rb_ptr->N_good;
}
delete_ringbuf(rb_ptr);
@@ -351,7 +356,7 @@
void c_runstats2(int nrb, int nd, int step, int ofs,
double *data, double *dmean, double *dstd,
double *dmin, double *dmax, double *dmed, double
-*dptile5, double *dptile95, int *ng)
+*dptile5, double *dptile95, int *nsorted, int *ng)
{
int i, j;
int npad = (nrb - 1) / 2;
@@ -365,17 +370,18 @@
dmed += ofs;
dptile5 += ofs;
dptile95 += ofs;
+ nsorted += ofs;
ng += ofs;
rb_ptr = new_ringbuf(nrb);
for (i = 0; i < npad; i++)
{
- ringbuf_add(rb_ptr, data[i*step]);
+ nsorted[j*step] = ringbuf_add(rb_ptr, data[i*step]);
}
for (j=0; j<nd; i++, j++)
{
- if (i < nd) {ringbuf_add(rb_ptr, data[i*step]);}
- else {ringbuf_add(rb_ptr, NaN);}
+ if (i < nd) {nsorted[j*step] = ringbuf_add(rb_ptr, data[i*step]);}
+ else {nsorted[j*step] = ringbuf_add(rb_ptr, NaN);}
dmean[j*step] = ringbuf_mean(rb_ptr);
dstd[j*step] = ringbuf_sd(rb_ptr);
dmin[j*step] = ringbuf_min(rb_ptr);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-12-22 16:17:02
|
Revision: 6691
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6691&view=rev
Author: jswhit
Date: 2008-12-22 16:16:58 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
mathpng no longer exists, use mathmpl
Modified Paths:
--------------
trunk/toolkits/basemap/doc/conf.py
Modified: trunk/toolkits/basemap/doc/conf.py
===================================================================
--- trunk/toolkits/basemap/doc/conf.py 2008-12-21 04:14:20 UTC (rev 6690)
+++ trunk/toolkits/basemap/doc/conf.py 2008-12-22 16:16:58 UTC (rev 6691)
@@ -27,7 +27,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['mathpng', 'sphinx.ext.autodoc']
+extensions = ['mathmpl', 'math_symbol_table', 'sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2008-12-21 04:14:24
|
Revision: 6690
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6690&view=rev
Author: leejjoon
Date: 2008-12-21 04:14:20 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
Merged revisions 6688-6689 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6688 | leejjoon | 2008-12-20 22:46:05 -0500 (Sat, 20 Dec 2008) | 1 line
fix hatch bug in pdf backend
........
r6689 | leejjoon | 2008-12-20 23:07:26 -0500 (Sat, 20 Dec 2008) | 1 line
fix dpi dependent offset of Shadow
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/hatch_demo.py
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
trunk/matplotlib/lib/matplotlib/patches.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6685
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6689
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-12-21 04:07:26 UTC (rev 6689)
+++ trunk/matplotlib/CHANGELOG 2008-12-21 04:14:20 UTC (rev 6690)
@@ -1,8 +1,13 @@
+2008-12-20 fix the dpi-dependent offset of Shadow. - JJL
+
+2008-12-20 fix the hatch bug in the pdf backend. minor update
+ in docs and example - JJL
+
2008-12-19 Add axes_locator attribute in Axes. Two examples are added.
- JJL
-2008-12-19 Update Axes.legend documnetation. /api/api_changes.rst is also
- updated to describe chages in keyword parameters.
+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
2008-12-18 add new arrow style, a line + filled triangles. -JJL
Modified: trunk/matplotlib/examples/pylab_examples/hatch_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-21 04:07:26 UTC (rev 6689)
+++ trunk/matplotlib/examples/pylab_examples/hatch_demo.py 2008-12-21 04:14:20 UTC (rev 6690)
@@ -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: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-21 04:07:26 UTC (rev 6689)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-21 04:14:20 UTC (rev 6690)
@@ -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: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-21 04:07:26 UTC (rev 6689)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-21 04:14:20 UTC (rev 6690)
@@ -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
@@ -373,7 +373,7 @@
self.patch = patch
self.props = props
self._ox, self._oy = ox, oy
- self._update_transform()
+ self._shadow_transform = transforms.Affine2D()
self._update()
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -391,20 +391,20 @@
self.set_facecolor((r,g,b,0.5))
self.set_edgecolor((r,g,b,0.5))
- def _update_transform(self):
- self._shadow_transform = transforms.Affine2D().translate(self._ox, self._oy)
+ def _update_transform(self, renderer):
+ ox = renderer.points_to_pixels(self._ox)
+ oy = renderer.points_to_pixels(self._oy)
+ self._shadow_transform.clear().translate(ox, oy)
def _get_ox(self):
return self._ox
def _set_ox(self, ox):
self._ox = ox
- self._update_transform()
def _get_oy(self):
return self._oy
def _set_oy(self, oy):
self._oy = oy
- self._update_transform()
def get_path(self):
return self.patch.get_path()
@@ -412,6 +412,10 @@
def get_patch_transform(self):
return self.patch.get_patch_transform() + self._shadow_transform
+ def draw(self, renderer):
+ self._update_transform(renderer)
+ Patch.draw(self, renderer)
+
class Rectangle(Patch):
"""
Draw a rectangle with lower left at *xy* = (*x*, *y*) with
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2008-12-21 04:07:28
|
Revision: 6689
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6689&view=rev
Author: leejjoon
Date: 2008-12-21 04:07:26 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
fix dpi dependent offset of Shadow
Modified Paths:
--------------
branches/v0_98_5_maint/CHANGELOG
branches/v0_98_5_maint/lib/matplotlib/patches.py
Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG 2008-12-21 03:46:05 UTC (rev 6688)
+++ branches/v0_98_5_maint/CHANGELOG 2008-12-21 04:07:26 UTC (rev 6689)
@@ -1,3 +1,5 @@
+2008-12-20 fix the dpi-dependent offset of Shadow. - JJL
+
2008-12-20 fix the hatch bug in the pdf backend. minor update
in docs and example - JJL
Modified: branches/v0_98_5_maint/lib/matplotlib/patches.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/patches.py 2008-12-21 03:46:05 UTC (rev 6688)
+++ branches/v0_98_5_maint/lib/matplotlib/patches.py 2008-12-21 04:07:26 UTC (rev 6689)
@@ -372,7 +372,7 @@
self.patch = patch
self.props = props
self._ox, self._oy = ox, oy
- self._update_transform()
+ self._shadow_transform = transforms.Affine2D()
self._update()
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -390,20 +390,20 @@
self.set_facecolor((r,g,b,0.5))
self.set_edgecolor((r,g,b,0.5))
- def _update_transform(self):
- self._shadow_transform = transforms.Affine2D().translate(self._ox, self._oy)
+ def _update_transform(self, renderer):
+ ox = renderer.points_to_pixels(self._ox)
+ oy = renderer.points_to_pixels(self._oy)
+ self._shadow_transform.clear().translate(ox, oy)
def _get_ox(self):
return self._ox
def _set_ox(self, ox):
self._ox = ox
- self._update_transform()
def _get_oy(self):
return self._oy
def _set_oy(self, oy):
self._oy = oy
- self._update_transform()
def get_path(self):
return self.patch.get_path()
@@ -411,6 +411,10 @@
def get_patch_transform(self):
return self.patch.get_patch_transform() + self._shadow_transform
+ def draw(self, renderer):
+ self._update_transform(renderer)
+ Patch.draw(self, renderer)
+
class Rectangle(Patch):
"""
Draw a rectangle with lower left at *xy* = (*x*, *y*) with
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2008-12-21 03:46:09
|
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.
|