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: <ef...@us...> - 2008-02-04 06:50:03
|
Revision: 4936
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4936&view=rev
Author: efiring
Date: 2008-02-03 22:50:00 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Add AxesImage.interpnames (based on old request by fr...@gm...)
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-02-03 21:38:20 UTC (rev 4935)
+++ trunk/matplotlib/CHANGELOG 2008-02-04 06:50:00 UTC (rev 4936)
@@ -1,3 +1,6 @@
+2008-02-03 Expose interpnames, a list of valid interpolation
+ methods, as an AxesImage class attribute. - EF
+
2008-02-03 Added BoundaryNorm, with examples in colorbar_only.py
and image_masked.py. - EF
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2008-02-03 21:38:20 UTC (rev 4935)
+++ trunk/matplotlib/lib/matplotlib/image.py 2008-02-04 06:50:00 UTC (rev 4936)
@@ -24,7 +24,32 @@
class AxesImage(martist.Artist, cm.ScalarMappable):
zorder = 1
+ # map interpolation strings to module constants
+ _interpd = {
+ 'nearest' : _image.NEAREST,
+ 'bilinear' : _image.BILINEAR,
+ 'bicubic' : _image.BICUBIC,
+ 'spline16' : _image.SPLINE16,
+ 'spline36' : _image.SPLINE36,
+ 'hanning' : _image.HANNING,
+ 'hamming' : _image.HAMMING,
+ 'hermite' : _image.HERMITE,
+ 'kaiser' : _image.KAISER,
+ 'quadric' : _image.QUADRIC,
+ 'catrom' : _image.CATROM,
+ 'gaussian' : _image.GAUSSIAN,
+ 'bessel' : _image.BESSEL,
+ 'mitchell' : _image.MITCHELL,
+ 'sinc' : _image.SINC,
+ 'lanczos' : _image.LANCZOS,
+ 'blackman' : _image.BLACKMAN,
+ }
+ # reverse interp dict
+ _interpdr = dict([ (v,k) for k,v in _interpd.items()])
+
+ interpnames = _interpd.keys()
+
def __init__(self, ax,
cmap = None,
norm = None,
@@ -59,30 +84,7 @@
self.set_filterrad(filterrad)
- # map interpolation strings to module constants
- self._interpd = {
- 'nearest' : _image.NEAREST,
- 'bilinear' : _image.BILINEAR,
- 'bicubic' : _image.BICUBIC,
- 'spline16' : _image.SPLINE16,
- 'spline36' : _image.SPLINE36,
- 'hanning' : _image.HANNING,
- 'hamming' : _image.HAMMING,
- 'hermite' : _image.HERMITE,
- 'kaiser' : _image.KAISER,
- 'quadric' : _image.QUADRIC,
- 'catrom' : _image.CATROM,
- 'gaussian' : _image.GAUSSIAN,
- 'bessel' : _image.BESSEL,
- 'mitchell' : _image.MITCHELL,
- 'sinc' : _image.SINC,
- 'lanczos' : _image.LANCZOS,
- 'blackman' : _image.BLACKMAN,
- }
- # reverse interp dict
- self._interpdr = dict([ (v,k) for k,v in self._interpd.items()])
-
self.set_interpolation(interpolation)
self.axes = ax
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-02-03 21:38:50
|
Revision: 4935
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4935&view=rev
Author: efiring
Date: 2008-02-03 13:38:20 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Fixed right-hand y tick label positioning bug reported by Darren Dale
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-02-03 21:26:42 UTC (rev 4934)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-02-03 21:38:20 UTC (rev 4935)
@@ -687,7 +687,7 @@
need to place axis elements in different locations.
"""
return (self._yaxis_transform +
- mtransforms.ScaledTranslation(-1 * pad_points / 72.0, 0,
+ mtransforms.ScaledTranslation(pad_points / 72.0, 0,
self.figure.dpi_scale_trans),
"center", "left")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-02-03 21:27:04
|
Revision: 4934
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4934&view=rev
Author: efiring
Date: 2008-02-03 13:26:42 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Modified BoundaryNorm, examples, colorbar support
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/colorbar_only.py
trunk/matplotlib/examples/image_masked.py
trunk/matplotlib/lib/matplotlib/colorbar.py
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-02-03 21:10:22 UTC (rev 4933)
+++ trunk/matplotlib/CHANGELOG 2008-02-03 21:26:42 UTC (rev 4934)
@@ -1,3 +1,6 @@
+2008-02-03 Added BoundaryNorm, with examples in colorbar_only.py
+ and image_masked.py. - EF
+
2008-02-03 Force dpi=72 in pdf backend to fix picture size bug. - JKS
2008-02-01 Fix reference leak in ft2font Glyph objects. - MGD
Modified: trunk/matplotlib/examples/colorbar_only.py
===================================================================
--- trunk/matplotlib/examples/colorbar_only.py 2008-02-03 21:10:22 UTC (rev 4933)
+++ trunk/matplotlib/examples/colorbar_only.py 2008-02-03 21:26:42 UTC (rev 4934)
@@ -35,7 +35,7 @@
# one greater than the length of the color list. The bounds must be
# monotonically increasing.
bounds = [1, 2, 4, 7, 8]
-norm = mpl.colors.BoundaryNorm(bounds)
+norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap,
norm=norm,
# to use 'extend', you must
Modified: trunk/matplotlib/examples/image_masked.py
===================================================================
--- trunk/matplotlib/examples/image_masked.py 2008-02-03 21:10:22 UTC (rev 4933)
+++ trunk/matplotlib/examples/image_masked.py 2008-02-03 21:26:42 UTC (rev 4934)
@@ -1,6 +1,8 @@
#!/usr/bin/env python
'''imshow with masked array input and out-of-range colors.
+ The second subplot illustrates the use of BoundaryNorm to
+ get a filled contour effect.
'''
from pylab import *
@@ -31,10 +33,23 @@
# range to which the regular palette color scale is applied.
# Anything above that range is colored based on palette.set_over, etc.
+subplot(1,2,1)
im = imshow(Zm, interpolation='bilinear',
cmap=palette,
norm = colors.Normalize(vmin = -1.0, vmax = 1.0, clip = False),
origin='lower', extent=[-3,3,-3,3])
title('Green=low, Red=high, Blue=bad')
-colorbar(im, extend='both', shrink=0.8)
+colorbar(im, extend='both', orientation='horizontal', shrink=0.8)
+
+subplot(1,2,2)
+im = imshow(Zm, interpolation='nearest',
+ cmap=palette,
+ norm = colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1],
+ ncolors=256, clip = False),
+ origin='lower', extent=[-3,3,-3,3])
+title('With BoundaryNorm')
+colorbar(im, extend='both', spacing='proportional',
+ orientation='horizontal', shrink=0.8)
+
show()
+
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2008-02-03 21:10:22 UTC (rev 4933)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2008-02-03 21:26:42 UTC (rev 4934)
@@ -323,6 +323,9 @@
nv = len(self._values)
base = 1 + int(nv/10)
locator = ticker.IndexLocator(base=base, offset=0)
+ elif isinstance(self.norm, colors.BoundaryNorm):
+ b = self.norm.boundaries
+ locator = ticker.FixedLocator(b, nbins=10)
elif isinstance(self.norm, colors.LogNorm):
locator = ticker.LogLocator()
else:
@@ -389,6 +392,23 @@
self._boundaries = b
self._values = v
return
+ elif isinstance(self.norm, colors.BoundaryNorm):
+ b = list(self.norm.boundaries)
+ if self.extend in ('both', 'min'):
+ b = [b[0]-1] + b
+ if self.extend in ('both', 'max'):
+ b = b + [b[-1] + 1]
+ b = npy.array(b)
+ v = npy.zeros((len(b)-1,), dtype=float)
+ bi = self.norm.boundaries
+ v[self._inside] = 0.5*(bi[:-1] + bi[1:])
+ if self.extend in ('both', 'min'):
+ v[0] = b[0] - 1
+ if self.extend in ('both', 'max'):
+ v[-1] = b[-1] + 1
+ self._boundaries = b
+ self._values = v
+ return
else:
if not self.norm.scaled():
self.norm.vmin = 0
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-02-03 21:10:22 UTC (rev 4933)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-02-03 21:26:42 UTC (rev 4934)
@@ -685,13 +685,41 @@
return vmin * pow((vmax/vmin), value)
class BoundaryNorm(Normalize):
- def __init__(self, boundaries, clip=False):
+ '''
+ Generate a colormap index based on discrete intervals.
+
+ Unlike Normalize or LogNorm, BoundaryNorm maps values
+ to integers instead of to the interval 0-1.
+
+ Mapping to the 0-1 interval could have been done via
+ piece-wise linear interpolation, but using integers seems
+ simpler, and reduces the number of conversions back and forth
+ between integer and floating point.
+ '''
+ def __init__(self, boundaries, ncolors, clip=False):
+ '''
+ args:
+ boundaries: a monotonically increasing sequence
+ ncolors: number of colors in the colormap to be used
+
+ If b[i] <= v < b[i+1] then v is mapped to color j;
+ as i varies from 0 to len(boundaries)-2,
+ j goes from 0 to ncolors-1.
+
+ Out-of-range values are mapped to -1 if low and ncolors
+ if high; these are converted to valid indices by
+ Colormap.__call__.
+ '''
self.clip = clip
self.vmin = boundaries[0]
self.vmax = boundaries[-1]
self.boundaries = npy.asarray(boundaries)
- self.midpoints = 0.5 *(self.boundaries[:-1] + self.boundaries[1:])
self.N = len(self.boundaries)
+ self.Ncmap = ncolors
+ if self.N-1 == self.Ncmap:
+ self._interp = False
+ else:
+ self._interp = True
def __call__(self, x, clip=None):
if clip is None:
@@ -704,15 +732,17 @@
iret = npy.zeros(x.shape, dtype=npy.int16)
for i, b in enumerate(self.boundaries):
iret[xx>=b] = i
+ if self._interp:
+ iret = (iret * (float(self.Ncmap-1)/(self.N-2))).astype(npy.int16)
iret[xx<self.vmin] = -1
- iret[xx>=self.vmax] = self.N
- ret = ma.array(iret / float(self.N-1), mask=mask)
+ iret[xx>=self.vmax] = self.Ncmap
+ ret = ma.array(iret, mask=mask)
if ret.shape == () and not mask:
- ret = float(ret) # assume python scalar
+ ret = int(ret) # assume python scalar
return ret
def inverse(self, value):
- return self.midpoints[int(value*(self.N-1))]
+ return ValueError("BoundaryNorm is not invertible")
class NoNorm(Normalize):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2008-02-03 21:10:25
|
Revision: 4933
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4933&view=rev
Author: jouni
Date: 2008-02-03 13:10:22 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Force the pdf backend to always use 72 as the dpi value. This fixes
the size problem of the resulting files (since the size is measured in
units of 1/72 inch). TODO: the user now has no control over the dpi
of images.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-02-02 21:32:21 UTC (rev 4932)
+++ trunk/matplotlib/CHANGELOG 2008-02-03 21:10:22 UTC (rev 4933)
@@ -1,3 +1,5 @@
+2008-02-03 Force dpi=72 in pdf backend to fix picture size bug. - JKS
+
2008-02-01 Fix reference leak in ft2font Glyph objects. - MGD
2008-01-31 Don't use unicode strings with usetex by default - DSD
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-02-02 21:32:21 UTC (rev 4932)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-02-03 21:10:22 UTC (rev 4933)
@@ -1853,8 +1853,9 @@
return 'pdf'
def print_pdf(self, filename, **kwargs):
- dpi = kwargs.get('dpi', 72)
- self.figure.set_dpi(dpi) # Override the dpi kwarg
+ dpi = 72 # there are 72 Postscript points to an inch
+ # TODO: use the dpi kwarg for images
+ self.figure.set_dpi(dpi)
width, height = self.figure.get_size_inches()
file = PdfFile(width, height, dpi, filename)
renderer = MixedModeRenderer(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-02-02 21:32:34
|
Revision: 4932
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4932&view=rev
Author: jdh2358
Date: 2008-02-02 13:32:21 -0800 (Sat, 02 Feb 2008)
Log Message:
-----------
added manual axis example
Added Paths:
-----------
trunk/matplotlib/examples/manual_axis.py
Added: trunk/matplotlib/examples/manual_axis.py
===================================================================
--- trunk/matplotlib/examples/manual_axis.py (rev 0)
+++ trunk/matplotlib/examples/manual_axis.py 2008-02-02 21:32:21 UTC (rev 4932)
@@ -0,0 +1,57 @@
+"""
+matplotlib is fairly rigid about how and where it draws it xaxis and
+yaxis, and it is a frequent request to be able to place these in other
+locations. While it is not possible to customize matplotlib's
+internal axis objects in this way, it is not too hard to simply turn
+them off and draw your own axis lines, tick lines, and tick labels
+where and how you want them
+"""
+
+import numpy as np
+from pylab import figure, show
+import matplotlib.lines as lines
+
+def make_xaxis(ax, yloc, offset=0.05, **props):
+ xmin, xmax = ax.get_xlim()
+ locs = [loc for loc in ax.xaxis.get_majorticklocs()
+ if loc>=xmin and loc<=xmax]
+ tickline, = ax.plot(locs, [yloc]*len(locs),linestyle='',
+ marker=lines.TICKDOWN, **props)
+ axline, = ax.plot([xmin, xmax], [yloc, yloc], **props)
+ tickline.set_clip_on(False)
+ axline.set_clip_on(False)
+ for loc in locs:
+ ax.text(loc, yloc-offset, '%1.1f'%loc,
+ horizontalalignment='center',
+ verticalalignment='top')
+
+def make_yaxis(ax, xloc=0, offset=0.05, **props):
+ ymin, ymax = ax.get_ylim()
+ locs = [loc for loc in ax.yaxis.get_majorticklocs()
+ if loc>=ymin and loc<=ymax]
+ tickline, = ax.plot([xloc]*len(locs), locs, linestyle='',
+ marker=lines.TICKLEFT, **props)
+ axline, = ax.plot([xloc, xloc], [ymin, ymax], **props)
+ tickline.set_clip_on(False)
+ axline.set_clip_on(False)
+
+ for loc in locs:
+ ax.text(xloc-offset, loc, '%1.1f'%loc,
+ verticalalignment='center',
+ horizontalalignment='right')
+
+
+props = dict(color='black', linewidth=2, markeredgewidth=2)
+x = np.arange(200.)
+y = np.sin(2*np.pi*x/200.) + np.random.rand(200)-0.5
+fig = figure(facecolor='white')
+ax = fig.add_subplot(111, frame_on=False)
+ax.axison = False
+ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue')
+ax.set_xlim(0, 200)
+ax.set_ylim(-1.5, 1.5)
+make_xaxis(ax, 0, offset=0.1, **props)
+make_yaxis(ax, 0, offset=5, **props)
+fig.savefig('manual_axis.png', dpi=100, facecolor='white', edgecolor='white')
+show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-02-02 08:21:45
|
Revision: 4931
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4931&view=rev
Author: efiring
Date: 2008-02-02 00:21:41 -0800 (Sat, 02 Feb 2008)
Log Message:
-----------
Fixed bug in vlines: it was not expanding scalar ymin, ymax
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-02-02 07:53:03 UTC (rev 4930)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-02-02 08:21:41 UTC (rev 4931)
@@ -2569,14 +2569,14 @@
if not iterable(xmin): xmin = [xmin]
if not iterable(xmax): xmax = [xmax]
y = npy.asarray(y)
+ xmin = npy.asarray(xmin)
+ xmax = npy.asarray(xmax)
if len(xmin)==1:
xmin = xmin*npy.ones(y.shape, y.dtype)
if len(xmax)==1:
xmax = xmax*npy.ones(y.shape, y.dtype)
- xmin = npy.asarray(xmin)
- xmax = npy.asarray(xmax)
if len(xmin)!=len(y):
raise ValueError, 'xmin and y are unequal sized sequences'
@@ -2640,8 +2640,11 @@
x = npy.asarray(x)
ymin = npy.asarray(ymin)
ymax = npy.asarray(ymax)
+ if len(ymin)==1:
+ ymin = ymin*npy.ones(x.shape, x.dtype)
+ if len(ymax)==1:
+ ymax = ymax*npy.ones(x.shape, x.dtype)
-
if len(ymin)!=len(x):
raise ValueError, 'ymin and x are unequal sized sequences'
if len(ymax)!=len(x):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-02-02 07:53:07
|
Revision: 4930
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4930&view=rev
Author: efiring
Date: 2008-02-01 23:53:03 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Added BoundaryNorm to support irregular discrete color intervals
Modified Paths:
--------------
trunk/matplotlib/examples/colorbar_only.py
trunk/matplotlib/lib/matplotlib/colorbar.py
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/examples/colorbar_only.py
===================================================================
--- trunk/matplotlib/examples/colorbar_only.py 2008-02-01 20:15:59 UTC (rev 4929)
+++ trunk/matplotlib/examples/colorbar_only.py 2008-02-02 07:53:03 UTC (rev 4930)
@@ -2,12 +2,12 @@
Make a colorbar as a separate figure.
'''
-import pylab
-import matplotlib as mpl
+from matplotlib import pyplot, mpl
# Make a figure and axes with dimensions as desired.
-fig = pylab.figure(figsize=(8,1.5))
-ax = fig.add_axes([0.05, 0.4, 0.9, 0.5])
+fig = pyplot.figure(figsize=(8,3))
+ax1 = fig.add_axes([0.05, 0.65, 0.9, 0.15])
+ax2 = fig.add_axes([0.05, 0.25, 0.9, 0.15])
# Set the colormap and norm to correspond to the data for which
# the colorbar will be used.
@@ -19,10 +19,33 @@
# standalone colorbar. There are many more kwargs, but the
# following gives a basic continuous colorbar with ticks
# and labels.
-cb = mpl.colorbar.ColorbarBase(ax, cmap=cmap,
+cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap,
norm=norm,
orientation='horizontal')
-cb.set_label('Some Units')
+cb1.set_label('Some Units')
-pylab.show()
+# The second example illustrates the use of a ListedColormap, a
+# BoundaryNorm, and extended ends to show the "over" and "under"
+# value colors.
+cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c'])
+cmap.set_over('0.25')
+cmap.set_under('0.75')
+# If a ListedColormap is used, the length of the bounds array must be
+# one greater than the length of the color list. The bounds must be
+# monotonically increasing.
+bounds = [1, 2, 4, 7, 8]
+norm = mpl.colors.BoundaryNorm(bounds)
+cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap,
+ norm=norm,
+ # to use 'extend', you must
+ # specify two extra boundaries:
+ boundaries=[0]+bounds+[13],
+ extend='both',
+ ticks=bounds, # optional
+ spacing='proportional',
+ orientation='horizontal')
+cb2.set_label('Discrete intervals, some other units')
+
+pyplot.show()
+
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2008-02-01 20:15:59 UTC (rev 4929)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2008-02-02 07:53:03 UTC (rev 4930)
@@ -356,7 +356,7 @@
if b is None:
b = self.boundaries
if b is not None:
- self._boundaries = npy.array(b)
+ self._boundaries = npy.asarray(b, dtype=float)
if self.values is None:
self._values = 0.5*(self._boundaries[:-1]
+ self._boundaries[1:])
@@ -456,7 +456,12 @@
Return colorbar data coordinates for the boundaries of
a proportional colorbar.
'''
- y = self.norm(self._boundaries.copy())
+ if isinstance(self.norm, colors.BoundaryNorm):
+ b = self._boundaries[self._inside]
+ y = (self._boundaries - self._boundaries[0])
+ y = y / (self._boundaries[-1] - self._boundaries[0])
+ else:
+ y = self.norm(self._boundaries.copy())
if self.extend in ('both', 'min'):
y[0] = -0.05
if self.extend in ('both', 'max'):
@@ -492,7 +497,7 @@
within range, together with their corresponding colorbar
data coordinates.
'''
- if isinstance(self.norm, colors.NoNorm):
+ if isinstance(self.norm, (colors.NoNorm, colors.BoundaryNorm)):
b = self._boundaries
xn = x
xout = x
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-02-01 20:15:59 UTC (rev 4929)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-02-02 07:53:03 UTC (rev 4930)
@@ -684,7 +684,37 @@
else:
return vmin * pow((vmax/vmin), value)
+class BoundaryNorm(Normalize):
+ def __init__(self, boundaries, clip=False):
+ self.clip = clip
+ self.vmin = boundaries[0]
+ self.vmax = boundaries[-1]
+ self.boundaries = npy.asarray(boundaries)
+ self.midpoints = 0.5 *(self.boundaries[:-1] + self.boundaries[1:])
+ self.N = len(self.boundaries)
+ def __call__(self, x, clip=None):
+ if clip is None:
+ clip = self.clip
+ x = ma.asarray(x)
+ mask = ma.getmaskarray(x)
+ xx = x.filled(self.vmax+1)
+ if clip:
+ npy.clip(xx, self.vmin, self.vmax)
+ iret = npy.zeros(x.shape, dtype=npy.int16)
+ for i, b in enumerate(self.boundaries):
+ iret[xx>=b] = i
+ iret[xx<self.vmin] = -1
+ iret[xx>=self.vmax] = self.N
+ ret = ma.array(iret / float(self.N-1), mask=mask)
+ if ret.shape == () and not mask:
+ ret = float(ret) # assume python scalar
+ return ret
+
+ def inverse(self, value):
+ return self.midpoints[int(value*(self.N-1))]
+
+
class NoNorm(Normalize):
'''
Dummy replacement for Normalize, for the case where we
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 20:16:01
|
Revision: 4929
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4929&view=rev
Author: mdboom
Date: 2008-02-01 12:15:59 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Fix tick-alignment problem (Thanks J?\195?\182rgen Stenarson)
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2008-02-01 19:15:20 UTC (rev 4928)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2008-02-01 20:15:59 UTC (rev 4929)
@@ -875,7 +875,7 @@
path, path_trans)
- _tickhoriz_path = Path([[0.0, 0.5], [1.0, 0.5]])
+ _tickhoriz_path = Path([[0.0, 0.0], [1.0, 0.0]])
def _draw_tickleft(self, renderer, gc, path, path_trans):
offset = renderer.points_to_pixels(self._markersize)
marker_transform = Affine2D().scale(-offset, 1.0)
@@ -890,7 +890,7 @@
path, path_trans)
- _tickvert_path = Path([[-0.5, 0.0], [-0.5, 1.0]])
+ _tickvert_path = Path([[-0.0, 0.0], [-0.0, 1.0]])
def _draw_tickup(self, renderer, gc, path, path_trans):
offset = renderer.points_to_pixels(self._markersize)
marker_transform = Affine2D().scale(1.0, offset)
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-02-01 19:15:20 UTC (rev 4928)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-02-01 20:15:59 UTC (rev 4929)
@@ -465,7 +465,7 @@
RendererAgg::draw_markers(const Py::Tuple& args) {
typedef agg::conv_transform<PathIterator> transformed_path_t;
typedef SimplifyPath<transformed_path_t> simplify_t;
- typedef agg::conv_curve<transformed_path_t> curve_t;
+ typedef agg::conv_curve<simplify_t> curve_t;
typedef agg::conv_stroke<curve_t> stroke_t;
typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
@@ -488,15 +488,15 @@
trans *= agg::trans_affine_translation(0.0, (double)height);
PathIterator marker_path(marker_path_obj);
+ bool marker_snap = should_snap(marker_path, marker_trans);
transformed_path_t marker_path_transformed(marker_path, marker_trans);
- curve_t marker_path_curve(marker_path_transformed);
+ simplify_t marker_path_simplified(marker_path_transformed, marker_snap, false, width, height);
+ curve_t marker_path_curve(marker_path_simplified);
PathIterator path(path_obj);
- bool snap = should_snap(path, trans);
transformed_path_t path_transformed(path, trans);
GCAgg gc = GCAgg(gc_obj, dpi);
- simplify_t path_simplified(path_transformed, snap, false, width, height);
- path_simplified.rewind(0);
+ path_transformed.rewind(0);
facepair_t face = _get_rgba_face(face_obj, gc.alpha);
@@ -549,7 +549,7 @@
agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
if (has_clippath) {
- while (path_simplified.vertex(&x, &y) != agg::path_cmd_stop) {
+ while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) {
pixfmt_amask_type pfa(*pixFmt, *alphaMask);
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r);
@@ -564,7 +564,7 @@
agg::render_scanlines(sa, sl, ren);
}
} else {
- while (path_simplified.vertex(&x, &y) != agg::path_cmd_stop) {
+ while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) {
if (face.first) {
rendererAA->color(face.second);
sa.init(fillCache, fillSize, x, y);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 19:15:24
|
Revision: 4928
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4928&view=rev
Author: mdboom
Date: 2008-02-01 11:15:20 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Merged revisions 4926-4927 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r4927 | mdboom | 2008-02-01 14:13:09 -0500 (Fri, 01 Feb 2008) | 2 lines
Fix doubly-included fonts in Postscript files.
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4925
+ /branches/v0_91_maint:1-4927
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-02-01 19:13:09 UTC (rev 4927)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-02-01 19:15:20 UTC (rev 4928)
@@ -552,7 +552,6 @@
A generic base class for all font setups that use Truetype fonts
(through ft2font)
"""
- basepath = os.path.join( get_data_path(), 'fonts' )
_fonts = {}
class CachedFont:
@@ -686,7 +685,7 @@
TruetypeFonts.__init__(self, *args, **kwargs)
if not len(self.fontmap):
for key, val in self._fontmap.iteritems():
- fullpath = os.path.join(self.basepath, 'ttf', val + ".ttf")
+ fullpath = findfont(val)
self.fontmap[key] = fullpath
self.fontmap[val] = fullpath
@@ -913,7 +912,7 @@
TruetypeFonts.__init__(self, *args, **kwargs)
if not len(self.fontmap):
for key, name in self._fontmap.iteritems():
- fullpath = os.path.join(self.basepath, 'ttf', name + ".ttf")
+ fullpath = findfont(name)
self.fontmap[key] = fullpath
self.fontmap[name] = fullpath
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 19:13:13
|
Revision: 4927
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4927&view=rev
Author: mdboom
Date: 2008-02-01 11:13:09 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Fix doubly-included fonts in Postscript files.
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/mathtext.py
Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-02-01 18:39:59 UTC (rev 4926)
+++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-02-01 19:13:09 UTC (rev 4927)
@@ -552,7 +552,6 @@
A generic base class for all font setups that use Truetype fonts
(through ft2font)
"""
- basepath = os.path.join( get_data_path(), 'fonts' )
_fonts = {}
class CachedFont:
@@ -686,7 +685,7 @@
TruetypeFonts.__init__(self, *args, **kwargs)
if not len(self.fontmap):
for key, val in self._fontmap.iteritems():
- fullpath = os.path.join(self.basepath, 'ttf', val + ".ttf")
+ fullpath = findfont(val)
self.fontmap[key] = fullpath
self.fontmap[val] = fullpath
@@ -913,7 +912,7 @@
TruetypeFonts.__init__(self, *args, **kwargs)
if not len(self.fontmap):
for key, name in self._fontmap.iteritems():
- fullpath = os.path.join(self.basepath, 'ttf', name + ".ttf")
+ fullpath = findfont(name)
self.fontmap[key] = fullpath
self.fontmap[name] = fullpath
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 18:40:03
|
Revision: 4926
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4926&view=rev
Author: mdboom
Date: 2008-02-01 10:39:59 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Merged revisions 4921-4925 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r4922 | mdboom | 2008-02-01 13:02:14 -0500 (Fri, 01 Feb 2008) | 3 lines
Backing out Glyph object leak fix, since it causes segfaults with PDF
backend. Will look into it further.
........
r4924 | mdboom | 2008-02-01 13:03:52 -0500 (Fri, 01 Feb 2008) | 2 lines
Oops in last commit.
........
r4925 | mdboom | 2008-02-01 13:36:38 -0500 (Fri, 01 Feb 2008) | 2 lines
Hopefully fixing the Glyph memory leak properly now.
........
Modified Paths:
--------------
trunk/matplotlib/src/ft2font.cpp
trunk/matplotlib/src/ft2font.h
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4920
+ /branches/v0_91_maint:1-4925
Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp 2008-02-01 18:36:38 UTC (rev 4925)
+++ trunk/matplotlib/src/ft2font.cpp 2008-02-01 18:39:59 UTC (rev 4926)
@@ -749,10 +749,6 @@
for (size_t i=0; i<glyphs.size(); i++) {
FT_Done_Glyph( glyphs[i] );
}
-
- for (size_t i=0; i<gms.size(); i++) {
- Py_DECREF(gms[i]);
- }
}
int
@@ -792,13 +788,8 @@
FT_Done_Glyph( glyphs[i] );
}
- for (size_t i=0; i<gms.size(); i++) {
- Py_DECREF(gms[i]);
- }
+ glyphs.clear();
- glyphs.resize(0);
- gms.resize(0);
-
return Py::Object();
}
@@ -1020,26 +1011,6 @@
return xys;
}
-
-char FT2Font::get_glyph__doc__[] =
-"get_glyph(num)\n"
-"\n"
-"Return the glyph object with num num\n"
-;
-Py::Object
-FT2Font::get_glyph(const Py::Tuple & args){
- _VERBOSE("FT2Font::get_glyph");
-
- args.verify_length(1);
- int num = Py::Int(args[0]);
-
- if ( (size_t)num >= gms.size())
- throw Py::ValueError("Glyph index out of range");
-
- Py_INCREF(gms[num]);
- return Py::asObject(gms[num]);
-}
-
char FT2Font::get_num_glyphs__doc__[] =
"get_num_glyphs()\n"
"\n"
@@ -1093,9 +1064,7 @@
size_t num = glyphs.size(); //the index into the glyphs list
glyphs.push_back(thisGlyph);
Glyph* gm = new Glyph(face, thisGlyph, num);
- gms.push_back(gm);
- Py_INCREF(gm);
- return Py::asObject( gm);
+ return Py::asObject(gm);
}
char FT2Font::get_width_height__doc__[] =
@@ -1763,8 +1732,6 @@
add_varargs_method("get_xys", &FT2Font::get_xys,
FT2Font::get_xys__doc__);
- add_varargs_method("get_glyph", &FT2Font::get_glyph,
- FT2Font::get_glyph__doc__);
add_varargs_method("get_num_glyphs", &FT2Font::get_num_glyphs,
FT2Font::get_num_glyphs__doc__);
add_keyword_method("load_char", &FT2Font::load_char,
Modified: trunk/matplotlib/src/ft2font.h
===================================================================
--- trunk/matplotlib/src/ft2font.h 2008-02-01 18:36:38 UTC (rev 4925)
+++ trunk/matplotlib/src/ft2font.h 2008-02-01 18:39:59 UTC (rev 4926)
@@ -30,11 +30,11 @@
void draw_bitmap(FT_Bitmap* bitmap, FT_Int x, FT_Int y);
void write_bitmap(const char* filename) const;
- void draw_rect(unsigned long x0, unsigned long y0,
+ void draw_rect(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1);
- void draw_rect_filled(unsigned long x0, unsigned long y0,
+ void draw_rect_filled(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1);
-
+
unsigned int get_width() const { return _width; };
unsigned int get_height() const { return _height; };
const unsigned char *const get_buffer() const { return _buffer; };
@@ -94,7 +94,6 @@
Py::Object set_size(const Py::Tuple & args);
Py::Object set_charmap(const Py::Tuple & args);
Py::Object set_text(const Py::Tuple & args, const Py::Dict & kwargs);
- Py::Object get_glyph(const Py::Tuple & args);
Py::Object get_kerning(const Py::Tuple & args);
Py::Object get_num_glyphs(const Py::Tuple & args);
Py::Object load_char(const Py::Tuple & args, const Py::Dict & kws);
@@ -124,7 +123,6 @@
FT_Error error;
std::vector<FT_Glyph> glyphs;
std::vector<FT_Vector> pos;
- std::vector<Glyph*> gms;
double angle;
double ptsize;
double dpi;
@@ -168,16 +166,16 @@
Glyph::init_type();
FT2Font::init_type();
- add_varargs_method("FT2Font", &ft2font_module::new_ft2font,
+ add_varargs_method("FT2Font", &ft2font_module::new_ft2font,
"FT2Font");
- add_varargs_method("FT2Image", &ft2font_module::new_ft2image,
+ add_varargs_method("FT2Image", &ft2font_module::new_ft2image,
"FT2Image");
initialize( "The ft2font module" );
}
-
- ~ft2font_module();
+
+ ~ft2font_module();
//static FT_Library ft2Library;
-
+
private:
Py::Object new_ft2font (const Py::Tuple &args);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 18:36:40
|
Revision: 4925
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4925&view=rev
Author: mdboom
Date: 2008-02-01 10:36:38 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Hopefully fixing the Glyph memory leak properly now.
Modified Paths:
--------------
branches/v0_91_maint/src/ft2font.cpp
branches/v0_91_maint/src/ft2font.h
Modified: branches/v0_91_maint/src/ft2font.cpp
===================================================================
--- branches/v0_91_maint/src/ft2font.cpp 2008-02-01 18:03:52 UTC (rev 4924)
+++ branches/v0_91_maint/src/ft2font.cpp 2008-02-01 18:36:38 UTC (rev 4925)
@@ -749,10 +749,6 @@
for (size_t i=0; i<glyphs.size(); i++) {
FT_Done_Glyph( glyphs[i] );
}
-
- for (size_t i=0; i<gms.size(); i++) {
- Py_DECREF(gms[i]);
- }
}
int
@@ -792,13 +788,8 @@
FT_Done_Glyph( glyphs[i] );
}
- for (size_t i=0; i<gms.size(); i++) {
- Py_DECREF(gms[i]);
- }
+ glyphs.clear();
- glyphs.resize(0);
- gms.resize(0);
-
return Py::Object();
}
@@ -1021,25 +1012,6 @@
}
-char FT2Font::get_glyph__doc__[] =
-"get_glyph(num)\n"
-"\n"
-"Return the glyph object with num num\n"
-;
-Py::Object
-FT2Font::get_glyph(const Py::Tuple & args){
- _VERBOSE("FT2Font::get_glyph");
-
- args.verify_length(1);
- int num = Py::Int(args[0]);
-
- if ( (size_t)num >= gms.size())
- throw Py::ValueError("Glyph index out of range");
-
- Py_INCREF(gms[num]);
- return Py::asObject(gms[num]);
-}
-
char FT2Font::get_num_glyphs__doc__[] =
"get_num_glyphs()\n"
"\n"
@@ -1093,9 +1065,7 @@
size_t num = glyphs.size(); //the index into the glyphs list
glyphs.push_back(thisGlyph);
Glyph* gm = new Glyph(face, thisGlyph, num);
- gms.push_back(gm);
- Py_INCREF(gm);
- return Py::asObject( gm);
+ return Py::asObject(gm);
}
char FT2Font::get_width_height__doc__[] =
@@ -1763,8 +1733,6 @@
add_varargs_method("get_xys", &FT2Font::get_xys,
FT2Font::get_xys__doc__);
- add_varargs_method("get_glyph", &FT2Font::get_glyph,
- FT2Font::get_glyph__doc__);
add_varargs_method("get_num_glyphs", &FT2Font::get_num_glyphs,
FT2Font::get_num_glyphs__doc__);
add_keyword_method("load_char", &FT2Font::load_char,
Modified: branches/v0_91_maint/src/ft2font.h
===================================================================
--- branches/v0_91_maint/src/ft2font.h 2008-02-01 18:03:52 UTC (rev 4924)
+++ branches/v0_91_maint/src/ft2font.h 2008-02-01 18:36:38 UTC (rev 4925)
@@ -30,11 +30,11 @@
void draw_bitmap(FT_Bitmap* bitmap, FT_Int x, FT_Int y);
void write_bitmap(const char* filename) const;
- void draw_rect(unsigned long x0, unsigned long y0,
+ void draw_rect(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1);
- void draw_rect_filled(unsigned long x0, unsigned long y0,
+ void draw_rect_filled(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1);
-
+
unsigned int get_width() const { return _width; };
unsigned int get_height() const { return _height; };
const unsigned char *const get_buffer() const { return _buffer; };
@@ -94,7 +94,6 @@
Py::Object set_size(const Py::Tuple & args);
Py::Object set_charmap(const Py::Tuple & args);
Py::Object set_text(const Py::Tuple & args, const Py::Dict & kwargs);
- Py::Object get_glyph(const Py::Tuple & args);
Py::Object get_kerning(const Py::Tuple & args);
Py::Object get_num_glyphs(const Py::Tuple & args);
Py::Object load_char(const Py::Tuple & args, const Py::Dict & kws);
@@ -124,7 +123,6 @@
FT_Error error;
std::vector<FT_Glyph> glyphs;
std::vector<FT_Vector> pos;
- std::vector<Glyph*> gms;
double angle;
double ptsize;
double dpi;
@@ -168,16 +166,16 @@
Glyph::init_type();
FT2Font::init_type();
- add_varargs_method("FT2Font", &ft2font_module::new_ft2font,
+ add_varargs_method("FT2Font", &ft2font_module::new_ft2font,
"FT2Font");
- add_varargs_method("FT2Image", &ft2font_module::new_ft2image,
+ add_varargs_method("FT2Image", &ft2font_module::new_ft2image,
"FT2Image");
initialize( "The ft2font module" );
}
-
- ~ft2font_module();
+
+ ~ft2font_module();
//static FT_Library ft2Library;
-
+
private:
Py::Object new_ft2font (const Py::Tuple &args);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 18:03:57
|
Revision: 4924
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4924&view=rev
Author: mdboom
Date: 2008-02-01 10:03:52 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Oops in last commit.
Modified Paths:
--------------
branches/v0_91_maint/src/ft2font.cpp
Modified: branches/v0_91_maint/src/ft2font.cpp
===================================================================
--- branches/v0_91_maint/src/ft2font.cpp 2008-02-01 18:03:04 UTC (rev 4923)
+++ branches/v0_91_maint/src/ft2font.cpp 2008-02-01 18:03:52 UTC (rev 4924)
@@ -1036,7 +1036,7 @@
if ( (size_t)num >= gms.size())
throw Py::ValueError("Glyph index out of range");
- Py_INCREF(gm);
+ Py_INCREF(gms[num]);
return Py::asObject(gms[num]);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 18:03:12
|
Revision: 4923
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4923&view=rev
Author: mdboom
Date: 2008-02-01 10:03:04 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Backing out Glyph object leak fix, since it causes segfaults with PDF
backend. Will look into it further.
Modified Paths:
--------------
trunk/matplotlib/src/ft2font.cpp
Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp 2008-02-01 18:02:14 UTC (rev 4922)
+++ trunk/matplotlib/src/ft2font.cpp 2008-02-01 18:03:04 UTC (rev 4923)
@@ -1036,6 +1036,7 @@
if ( (size_t)num >= gms.size())
throw Py::ValueError("Glyph index out of range");
+ Py_INCREF(gms[num]);
return Py::asObject(gms[num]);
}
@@ -1093,6 +1094,7 @@
glyphs.push_back(thisGlyph);
Glyph* gm = new Glyph(face, thisGlyph, num);
gms.push_back(gm);
+ Py_INCREF(gm);
return Py::asObject( gm);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 18:02:24
|
Revision: 4922
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4922&view=rev
Author: mdboom
Date: 2008-02-01 10:02:14 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Backing out Glyph object leak fix, since it causes segfaults with PDF
backend. Will look into it further.
Modified Paths:
--------------
branches/v0_91_maint/src/ft2font.cpp
Modified: branches/v0_91_maint/src/ft2font.cpp
===================================================================
--- branches/v0_91_maint/src/ft2font.cpp 2008-02-01 17:36:48 UTC (rev 4921)
+++ branches/v0_91_maint/src/ft2font.cpp 2008-02-01 18:02:14 UTC (rev 4922)
@@ -1036,6 +1036,7 @@
if ( (size_t)num >= gms.size())
throw Py::ValueError("Glyph index out of range");
+ Py_INCREF(gm);
return Py::asObject(gms[num]);
}
@@ -1093,6 +1094,7 @@
glyphs.push_back(thisGlyph);
Glyph* gm = new Glyph(face, thisGlyph, num);
gms.push_back(gm);
+ Py_INCREF(gm);
return Py::asObject( gm);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 17:36:52
|
Revision: 4921
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4921&view=rev
Author: mdboom
Date: 2008-02-01 09:36:48 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Merged revisions 4919-4920 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r4920 | mdboom | 2008-02-01 12:24:56 -0500 (Fri, 01 Feb 2008) | 3 lines
Change "delete" to "delete []" for arrays on the heap. (It's
technically more correct, but also pleases valgrind.)
........
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4918
+ /branches/v0_91_maint:1-4920
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 17:24:59
|
Revision: 4920
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4920&view=rev
Author: mdboom
Date: 2008-02-01 09:24:56 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Change "delete" to "delete []" for arrays on the heap. (It's
technically more correct, but also pleases valgrind.)
Modified Paths:
--------------
branches/v0_91_maint/src/_backend_agg.cpp
Modified: branches/v0_91_maint/src/_backend_agg.cpp
===================================================================
--- branches/v0_91_maint/src/_backend_agg.cpp 2008-02-01 17:23:41 UTC (rev 4919)
+++ branches/v0_91_maint/src/_backend_agg.cpp 2008-02-01 17:24:56 UTC (rev 4920)
@@ -1110,10 +1110,10 @@
newXCoords[k] += newXOffsets[k];
newYCoords[k] += newYOffsets[k];
}
- delete xOffsets;
- delete yOffsets;
- delete newXOffsets;
- delete newYOffsets;
+ delete[] xOffsets;
+ delete[] yOffsets;
+ delete[] newXOffsets;
+ delete[] newYOffsets;
}
for(q=0; q < Nverts; q++)
@@ -1129,8 +1129,8 @@
Py_XDECREF(xCoords);
Py_XDECREF(yCoords);
Py_XDECREF(colors);
- delete newXCoords;
- delete newYCoords;
+ delete[] newXCoords;
+ delete[] newYCoords;
//printf("#2: %d\n", clock());
return Py::Object();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 17:23:45
|
Revision: 4919
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4919&view=rev
Author: mdboom
Date: 2008-02-01 09:23:41 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Merged revisions 4915-4918 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r4916 | dsdale | 2008-01-31 14:05:28 -0500 (Thu, 31 Jan 2008) | 2 lines
fixed a bug in ticker, unicode string passed to tex
........
r4917 | dsdale | 2008-01-31 14:14:20 -0500 (Thu, 31 Jan 2008) | 2 lines
forgot to change unicode string to raw string
........
r4918 | mdboom | 2008-02-01 12:19:02 -0500 (Fri, 01 Feb 2008) | 2 lines
Fix reference leak on Glyph objects.
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/src/ft2font.cpp
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4914
+ /branches/v0_91_maint:1-4918
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-02-01 17:19:02 UTC (rev 4918)
+++ trunk/matplotlib/CHANGELOG 2008-02-01 17:23:41 UTC (rev 4919)
@@ -1,3 +1,7 @@
+2008-02-01 Fix reference leak in ft2font Glyph objects. - MGD
+
+2008-01-31 Don't use unicode strings with usetex by default - DSD
+
2008-01-31 Fix text spacing problems in PDF backend with *some* fonts,
such as STIXGeneral.
Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp 2008-02-01 17:19:02 UTC (rev 4918)
+++ trunk/matplotlib/src/ft2font.cpp 2008-02-01 17:23:41 UTC (rev 4919)
@@ -8,9 +8,9 @@
/**
To improve the hinting of the fonts, this code uses a hack
presented here:
-
+
http://antigrain.com/research/font_rasterization/index.html
-
+
The idea is to limit the effect of hinting in the x-direction, while
preserving hinting in the y-direction. Since freetype does not
support this directly, the dpi in the x-direction is set higher than
@@ -20,7 +20,7 @@
hinting, whereas the global transform does not, this is documented
behavior of freetype, and therefore hopefully unlikely to change.
The freetype 2 tutorial says:
-
+
NOTE: The transformation is applied to every glyph that is
loaded through FT_Load_Glyph and is completely independent of
any hinting process. This means that you won't get the same
@@ -42,7 +42,7 @@
FT_Library _ft2Library;
-// FT2Image::FT2Image() :
+// FT2Image::FT2Image() :
// _isDirty(true),
// _buffer(NULL),
// _width(0), _height(0),
@@ -53,7 +53,7 @@
FT2Image::FT2Image(unsigned long width, unsigned long height) :
_isDirty(true),
- _buffer(NULL),
+ _buffer(NULL),
_width(0), _height(0),
_rgbCopy(NULL),
_rgbaCopy(NULL) {
@@ -61,10 +61,10 @@
resize(width, height);
}
-FT2Image::~FT2Image() {
+FT2Image::~FT2Image() {
_VERBOSE("FT2Image::~FT2Image");
- delete [] _buffer;
- _buffer=NULL;
+ delete [] _buffer;
+ _buffer=NULL;
delete _rgbCopy;
delete _rgbaCopy;
}
@@ -151,7 +151,7 @@
}
void
-FT2Image::draw_rect(unsigned long x0, unsigned long y0,
+FT2Image::draw_rect(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1) {
if ( x0<0 || y0<0 || x1<0 || y1<0 ||
x0>_width || x1>_width ||
@@ -195,7 +195,7 @@
return Py::Object();
}
-void FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0,
+void FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1) {
x0 = CLAMP(x0, 0, _width);
y0 = CLAMP(y0, 0, _height);
@@ -209,7 +209,7 @@
}
_isDirty = true;
-}
+}
char FT2Image::draw_rect_filled__doc__[] =
"draw_rect_filled(x0, y0, x1, y1)\n"
@@ -245,7 +245,7 @@
args.verify_length(0);
return Py::asObject
- (PyString_FromStringAndSize((const char *)_buffer,
+ (PyString_FromStringAndSize((const char *)_buffer,
_width*_height)
);
}
@@ -284,7 +284,7 @@
args.verify_length(0);
makeRgbCopy();
-
+
return _rgbCopy->py_as_str(args);
}
@@ -321,7 +321,7 @@
args.verify_length(0);
makeRgbaCopy();
-
+
return _rgbaCopy->py_as_str(args);
}
@@ -671,7 +671,7 @@
}
// set a default fontsize 12 pt at 72dpi
-#ifdef VERTICAL_HINTING
+#ifdef VERTICAL_HINTING
error = FT_Set_Char_Size( face, 12 * 64, 0, 72 * HORIZ_HINTING, 72 );
static FT_Matrix transform = { 65536 / HORIZ_HINTING, 0, 0, 65536 };
FT_Set_Transform( face, &transform, 0 );
@@ -829,7 +829,7 @@
int error = FT_Set_Char_Size( face, (long)(ptsize * 64), 0,
(unsigned int)dpi,
(unsigned int)dpi );
-#endif
+#endif
if (error)
throw Py::RuntimeError("Could not set the fontsize");
return Py::Object();
@@ -1036,7 +1036,6 @@
if ( (size_t)num >= gms.size())
throw Py::ValueError("Glyph index out of range");
- Py_INCREF(gms[num]);
return Py::asObject(gms[num]);
}
@@ -1078,7 +1077,7 @@
long charcode = Py::Long(args[0]), flags = Py::Long(FT_LOAD_FORCE_AUTOHINT);
if (kwargs.hasKey("flags"))
flags = Py::Long(kwargs["flags"]);
-
+
int error = FT_Load_Char( face, (unsigned long)charcode, flags);
if (error)
@@ -1094,7 +1093,6 @@
glyphs.push_back(thisGlyph);
Glyph* gm = new Glyph(face, thisGlyph, num);
gms.push_back(gm);
- Py_INCREF(gm); //todo: refcount correct?
return Py::asObject( gm);
}
@@ -1659,7 +1657,7 @@
}
}
-char FT2Font::get_image__doc__ [] =
+char FT2Font::get_image__doc__ [] =
"get_image()\n"
"\n"
"Returns the underlying image buffer for this font object.\n";
@@ -1669,7 +1667,7 @@
if (image) {
Py_XINCREF(image);
return Py::asObject(image);
- }
+ }
throw Py::RuntimeError("You must call .set_text() before .get_image()");
}
@@ -1684,7 +1682,7 @@
args.verify_length(1);
std::string filename = Py::String(args[0]);
- FT_Error error =
+ FT_Error error =
FT_Attach_File(face, filename.c_str());
if (error) {
@@ -1884,7 +1882,7 @@
d["KERNING_DEFAULT"] = Py::Int(FT_KERNING_DEFAULT);
d["KERNING_UNFITTED"] = Py::Int(FT_KERNING_UNFITTED);
d["KERNING_UNSCALED"] = Py::Int(FT_KERNING_UNSCALED);
-
+
d["LOAD_DEFAULT"] = Py::Long(FT_LOAD_DEFAULT);
d["LOAD_NO_SCALE"] = Py::Long(FT_LOAD_NO_SCALE);
d["LOAD_NO_HINTING"] = Py::Long(FT_LOAD_NO_HINTING);
@@ -1894,7 +1892,7 @@
d["LOAD_FORCE_AUTOHINT"] = Py::Long(FT_LOAD_FORCE_AUTOHINT);
d["LOAD_CROP_BITMAP"] = Py::Long(FT_LOAD_CROP_BITMAP);
d["LOAD_PEDANTIC"] = Py::Long(FT_LOAD_PEDANTIC);
- d["LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH"] =
+ d["LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH"] =
Py::Long(FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
d["LOAD_NO_RECURSE"] = Py::Long(FT_LOAD_NO_RECURSE);
d["LOAD_IGNORE_TRANSFORM"] = Py::Long(FT_LOAD_IGNORE_TRANSFORM);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-02-01 17:19:11
|
Revision: 4918
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4918&view=rev
Author: mdboom
Date: 2008-02-01 09:19:02 -0800 (Fri, 01 Feb 2008)
Log Message:
-----------
Fix reference leak on Glyph objects.
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/src/ft2font.cpp
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-01-31 19:14:20 UTC (rev 4917)
+++ branches/v0_91_maint/CHANGELOG 2008-02-01 17:19:02 UTC (rev 4918)
@@ -1,3 +1,5 @@
+2008-02-01 Fix reference leak in ft2font Glyph objects. - MGD
+
2008-01-31 Don't use unicode strings with usetex by default - DSD
2008-01-31 Fix text spacing problems in PDF backend with *some* fonts,
Modified: branches/v0_91_maint/src/ft2font.cpp
===================================================================
--- branches/v0_91_maint/src/ft2font.cpp 2008-01-31 19:14:20 UTC (rev 4917)
+++ branches/v0_91_maint/src/ft2font.cpp 2008-02-01 17:19:02 UTC (rev 4918)
@@ -8,9 +8,9 @@
/**
To improve the hinting of the fonts, this code uses a hack
presented here:
-
+
http://antigrain.com/research/font_rasterization/index.html
-
+
The idea is to limit the effect of hinting in the x-direction, while
preserving hinting in the y-direction. Since freetype does not
support this directly, the dpi in the x-direction is set higher than
@@ -20,7 +20,7 @@
hinting, whereas the global transform does not, this is documented
behavior of freetype, and therefore hopefully unlikely to change.
The freetype 2 tutorial says:
-
+
NOTE: The transformation is applied to every glyph that is
loaded through FT_Load_Glyph and is completely independent of
any hinting process. This means that you won't get the same
@@ -42,7 +42,7 @@
FT_Library _ft2Library;
-// FT2Image::FT2Image() :
+// FT2Image::FT2Image() :
// _isDirty(true),
// _buffer(NULL),
// _width(0), _height(0),
@@ -53,7 +53,7 @@
FT2Image::FT2Image(unsigned long width, unsigned long height) :
_isDirty(true),
- _buffer(NULL),
+ _buffer(NULL),
_width(0), _height(0),
_rgbCopy(NULL),
_rgbaCopy(NULL) {
@@ -61,10 +61,10 @@
resize(width, height);
}
-FT2Image::~FT2Image() {
+FT2Image::~FT2Image() {
_VERBOSE("FT2Image::~FT2Image");
- delete [] _buffer;
- _buffer=NULL;
+ delete [] _buffer;
+ _buffer=NULL;
delete _rgbCopy;
delete _rgbaCopy;
}
@@ -151,7 +151,7 @@
}
void
-FT2Image::draw_rect(unsigned long x0, unsigned long y0,
+FT2Image::draw_rect(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1) {
if ( x0<0 || y0<0 || x1<0 || y1<0 ||
x0>_width || x1>_width ||
@@ -195,7 +195,7 @@
return Py::Object();
}
-void FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0,
+void FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1) {
x0 = CLAMP(x0, 0, _width);
y0 = CLAMP(y0, 0, _height);
@@ -209,7 +209,7 @@
}
_isDirty = true;
-}
+}
char FT2Image::draw_rect_filled__doc__[] =
"draw_rect_filled(x0, y0, x1, y1)\n"
@@ -245,7 +245,7 @@
args.verify_length(0);
return Py::asObject
- (PyString_FromStringAndSize((const char *)_buffer,
+ (PyString_FromStringAndSize((const char *)_buffer,
_width*_height)
);
}
@@ -284,7 +284,7 @@
args.verify_length(0);
makeRgbCopy();
-
+
return _rgbCopy->py_as_str(args);
}
@@ -321,7 +321,7 @@
args.verify_length(0);
makeRgbaCopy();
-
+
return _rgbaCopy->py_as_str(args);
}
@@ -671,7 +671,7 @@
}
// set a default fontsize 12 pt at 72dpi
-#ifdef VERTICAL_HINTING
+#ifdef VERTICAL_HINTING
error = FT_Set_Char_Size( face, 12 * 64, 0, 72 * HORIZ_HINTING, 72 );
static FT_Matrix transform = { 65536 / HORIZ_HINTING, 0, 0, 65536 };
FT_Set_Transform( face, &transform, 0 );
@@ -829,7 +829,7 @@
int error = FT_Set_Char_Size( face, (long)(ptsize * 64), 0,
(unsigned int)dpi,
(unsigned int)dpi );
-#endif
+#endif
if (error)
throw Py::RuntimeError("Could not set the fontsize");
return Py::Object();
@@ -1036,7 +1036,6 @@
if ( (size_t)num >= gms.size())
throw Py::ValueError("Glyph index out of range");
- Py_INCREF(gms[num]);
return Py::asObject(gms[num]);
}
@@ -1078,7 +1077,7 @@
long charcode = Py::Long(args[0]), flags = Py::Long(FT_LOAD_FORCE_AUTOHINT);
if (kwargs.hasKey("flags"))
flags = Py::Long(kwargs["flags"]);
-
+
int error = FT_Load_Char( face, (unsigned long)charcode, flags);
if (error)
@@ -1094,7 +1093,6 @@
glyphs.push_back(thisGlyph);
Glyph* gm = new Glyph(face, thisGlyph, num);
gms.push_back(gm);
- Py_INCREF(gm); //todo: refcount correct?
return Py::asObject( gm);
}
@@ -1659,7 +1657,7 @@
}
}
-char FT2Font::get_image__doc__ [] =
+char FT2Font::get_image__doc__ [] =
"get_image()\n"
"\n"
"Returns the underlying image buffer for this font object.\n";
@@ -1669,7 +1667,7 @@
if (image) {
Py_XINCREF(image);
return Py::asObject(image);
- }
+ }
throw Py::RuntimeError("You must call .set_text() before .get_image()");
}
@@ -1684,7 +1682,7 @@
args.verify_length(1);
std::string filename = Py::String(args[0]);
- FT_Error error =
+ FT_Error error =
FT_Attach_File(face, filename.c_str());
if (error) {
@@ -1884,7 +1882,7 @@
d["KERNING_DEFAULT"] = Py::Int(FT_KERNING_DEFAULT);
d["KERNING_UNFITTED"] = Py::Int(FT_KERNING_UNFITTED);
d["KERNING_UNSCALED"] = Py::Int(FT_KERNING_UNSCALED);
-
+
d["LOAD_DEFAULT"] = Py::Long(FT_LOAD_DEFAULT);
d["LOAD_NO_SCALE"] = Py::Long(FT_LOAD_NO_SCALE);
d["LOAD_NO_HINTING"] = Py::Long(FT_LOAD_NO_HINTING);
@@ -1894,7 +1892,7 @@
d["LOAD_FORCE_AUTOHINT"] = Py::Long(FT_LOAD_FORCE_AUTOHINT);
d["LOAD_CROP_BITMAP"] = Py::Long(FT_LOAD_CROP_BITMAP);
d["LOAD_PEDANTIC"] = Py::Long(FT_LOAD_PEDANTIC);
- d["LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH"] =
+ d["LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH"] =
Py::Long(FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
d["LOAD_NO_RECURSE"] = Py::Long(FT_LOAD_NO_RECURSE);
d["LOAD_IGNORE_TRANSFORM"] = Py::Long(FT_LOAD_IGNORE_TRANSFORM);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-01-31 19:15:18
|
Revision: 4917
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4917&view=rev
Author: dsdale
Date: 2008-01-31 11:14:20 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
forgot to change unicode string to raw string
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/ticker.py
Modified: branches/v0_91_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/ticker.py 2008-01-31 19:05:28 UTC (rev 4916)
+++ branches/v0_91_maint/lib/matplotlib/ticker.py 2008-01-31 19:14:20 UTC (rev 4917)
@@ -338,7 +338,7 @@
return ''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
elif self._usetex:
if sciNotStr != '':
- sciNotStr = u'\times%s' % sciNotStr
+ sciNotStr = r'\times%s' % sciNotStr
return ''.join(('$',sciNotStr,offsetStr,'$'))
else:
return ''.join((sciNotStr,offsetStr))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-01-31 19:06:00
|
Revision: 4916
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4916&view=rev
Author: dsdale
Date: 2008-01-31 11:05:28 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
fixed a bug in ticker, unicode string passed to tex
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/ticker.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-01-31 19:01:38 UTC (rev 4915)
+++ branches/v0_91_maint/CHANGELOG 2008-01-31 19:05:28 UTC (rev 4916)
@@ -1,3 +1,5 @@
+2008-01-31 Don't use unicode strings with usetex by default - DSD
+
2008-01-31 Fix text spacing problems in PDF backend with *some* fonts,
such as STIXGeneral.
Modified: branches/v0_91_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/ticker.py 2008-01-31 19:01:38 UTC (rev 4915)
+++ branches/v0_91_maint/lib/matplotlib/ticker.py 2008-01-31 19:05:28 UTC (rev 4916)
@@ -338,7 +338,7 @@
return ''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
elif self._usetex:
if sciNotStr != '':
- sciNotStr = u'\xd7%s' % sciNotStr
+ sciNotStr = u'\times%s' % sciNotStr
return ''.join(('$',sciNotStr,offsetStr,'$'))
else:
return ''.join((sciNotStr,offsetStr))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-01-31 19:01:43
|
Revision: 4915
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4915&view=rev
Author: mdboom
Date: 2008-01-31 11:01:38 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
Merged revisions 4912-4914 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r4914 | mdboom | 2008-01-31 13:59:22 -0500 (Thu, 31 Jan 2008) | 2 lines
Fix text spacing problems in PDF backend with some fonts.
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4911
+ /branches/v0_91_maint:1-4914
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-01-31 18:59:22 UTC (rev 4914)
+++ trunk/matplotlib/CHANGELOG 2008-01-31 19:01:38 UTC (rev 4915)
@@ -1,3 +1,6 @@
+2008-01-31 Fix text spacing problems in PDF backend with *some* fonts,
+ such as STIXGeneral.
+
2008-01-31 Fix \sqrt with radical number (broken by making [ and ]
work below) - MGD
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-01-31 18:59:22 UTC (rev 4914)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-01-31 19:01:38 UTC (rev 4915)
@@ -801,8 +801,7 @@
ccode = ord(c)
gind = cmap.get(ccode) or 0
glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
- # Why divided by 3.0 ??? Wish I knew... MGD
- widths.append((ccode, cvt(glyph.horiAdvance) / 3.0))
+ widths.append((ccode, glyph.horiAdvance / 6))
if ccode < 65536:
cid_to_gid_map[ccode] = unichr(gind)
max_ccode = max(ccode, max_ccode)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-01-31 18:59:25
|
Revision: 4914
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4914&view=rev
Author: mdboom
Date: 2008-01-31 10:59:22 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
Fix text spacing problems in PDF backend with some fonts.
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-01-31 17:46:56 UTC (rev 4913)
+++ branches/v0_91_maint/CHANGELOG 2008-01-31 18:59:22 UTC (rev 4914)
@@ -1,3 +1,6 @@
+2008-01-31 Fix text spacing problems in PDF backend with *some* fonts,
+ such as STIXGeneral.
+
2008-01-31 Fix \sqrt with radical number (broken by making [ and ]
work below) - MGD
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-01-31 17:46:56 UTC (rev 4913)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-01-31 18:59:22 UTC (rev 4914)
@@ -795,8 +795,7 @@
ccode = ord(c)
gind = cmap.get(ccode) or 0
glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
- # Why divided by 3.0 ??? Wish I knew... MGD
- widths.append((ccode, cvt(glyph.horiAdvance) / 3.0))
+ widths.append((ccode, glyph.horiAdvance / 6))
if ccode < 65536:
cid_to_gid_map[ccode] = unichr(gind)
max_ccode = max(ccode, max_ccode)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-01-31 17:47:04
|
Revision: 4913
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4913&view=rev
Author: jdh2358
Date: 2008-01-31 09:46:56 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
fixed a bug where annotations w/ arrows were not getting the figure instance set properly
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -169,12 +169,14 @@
def __str__(self):
if self._label != "":
return "Line2D(%s)"%(self._label)
- elif len(self._x) > 3:
+ elif hasattr(self, '_x') and len(self._x) > 3:
return "Line2D((%g,%g),(%g,%g),...,(%g,%g))"\
%(self._x[0],self._y[0],self._x[0],self._y[0],self._x[-1],self._y[-1])
- else:
+ elif hasattr(self, '_x'):
return "Line2D(%s)"\
%(",".join(["(%g,%g)"%(x,y) for x,y in zip(self._x,self._y)]))
+ else:
+ return "Line2D()"
def __init__(self, xdata, ydata,
linewidth = None, # all Nones default to rc
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -84,7 +84,7 @@
"""
from __future__ import division
-import csv, warnings
+import csv, warnings, copy
import numpy as npy
@@ -2186,7 +2186,12 @@
# Get header and remove invalid characters
needheader = names is None
if needheader:
- headers = reader.next()
+ for row in reader:
+ if len(row) and row[0].startswith(comments):
+ continue
+ headers = row
+ break
+
# remove these chars
delete = set("""~!@#$%^&*()-=+~\|]}[{';: /?.>,<""")
delete.add('"')
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -425,12 +425,12 @@
'figure.facecolor' : [ '0.75', validate_color], # facecolor; scalar gray
'figure.edgecolor' : [ 'w', validate_color], # edgecolor; white
- 'figure.subplot.left' : [0.125, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.right' : [0.9, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.bottom' : [0.1, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.top' : [0.9, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.wspace' : [0.2, ValidateInterval(0, 1, closedmin=False, closedmax=True)],
- 'figure.subplot.hspace' : [0.2, ValidateInterval(0, 1, closedmin=False, closedmax=True)],
+ 'figure.subplot.left' : [0.125, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.right' : [0.9, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.bottom' : [0.1, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.top' : [0.9, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.wspace' : [0.2, ValidateInterval(0, 1, closedmin=True, closedmax=False)],
+ 'figure.subplot.hspace' : [0.2, ValidateInterval(0, 1, closedmin=True, closedmax=False)],
'figure.autolayout' : [False, validate_bool],
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -1052,6 +1052,12 @@
return t,tinfo
+ def set_figure(self, fig):
+
+ if self.arrow is not None:
+ self.arrow.set_figure(fig)
+ Artist.set_figure(self, fig)
+
def set_clip_box(self, clipbox):
"""
Set the artist's clip Bbox
@@ -1204,6 +1210,8 @@
self.update_positions(renderer)
if self.arrow is not None:
+ if self.arrow.figure is None and self.figure is not None:
+ self.arrow.figure = self.figure
self.arrow.draw(renderer)
Text.draw(self, renderer)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-01-31 15:28:39
|
Revision: 4912
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4912&view=rev
Author: mdboom
Date: 2008-01-31 07:28:29 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
Merged revisions 4867-4911 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r4874 | jdh2358 | 2008-01-16 23:13:27 -0500 (Wed, 16 Jan 2008) | 1 line
forced nonunicode fname for save in agg
........
r4879 | mdboom | 2008-01-18 12:59:51 -0500 (Fri, 18 Jan 2008) | 2 lines
Fix poly_editor.py
........
r4882 | mdboom | 2008-01-21 14:03:48 -0500 (Mon, 21 Jan 2008) | 2 lines
Fix bug with pie chart slices less than 2.5 degrees.
........
r4896 | efiring | 2008-01-25 19:11:36 -0500 (Fri, 25 Jan 2008) | 2 lines
Apply patch by Manuel Metz to scatter docstring.
........
r4904 | jrevans | 2008-01-28 13:02:31 -0500 (Mon, 28 Jan 2008) | 4 lines
Fixed a bug where plotting a singe point unitized errorbar data would
fail. Fixed a bug where plotting errorbar data where the error is a
duration for a time valued axes would fail.
........
r4907 | mdboom | 2008-01-29 15:24:58 -0500 (Tue, 29 Jan 2008) | 1 line
Allow updating of shared axes when calling Axes.axis() (Thanks Jorgen Stenarson)
........
r4911 | mdboom | 2008-01-31 10:21:10 -0500 (Thu, 31 Jan 2008) | 2 lines
Fix \sqrt with a numeric radical.
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/mathtext_examples.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/mathtext.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4866
+ /branches/v0_91_maint:1-4911
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-01-31 15:21:10 UTC (rev 4911)
+++ trunk/matplotlib/CHANGELOG 2008-01-31 15:28:29 UTC (rev 4912)
@@ -1,3 +1,6 @@
+2008-01-31 Fix \sqrt with radical number (broken by making [ and ]
+ work below) - MGD
+
2008-01-27 Applied Martin Teichmann's patch to improve the Qt4
backend. Uses Qt's builtin toolbars and statusbars.
See bug 1828848 - DSD
Modified: trunk/matplotlib/examples/mathtext_examples.py
===================================================================
--- trunk/matplotlib/examples/mathtext_examples.py 2008-01-31 15:21:10 UTC (rev 4911)
+++ trunk/matplotlib/examples/mathtext_examples.py 2008-01-31 15:28:29 UTC (rev 4912)
@@ -40,7 +40,7 @@
r"$f^'$",
r'$\frac{x_2888}{y}$',
r"$\sqrt[3]{\frac{X_2}{Y}}=5$",
- r"$\sqrt[5x\pi]{\prod^\frac{x}{2\pi^2}_\infty}$",
+ r"$\sqrt[5]{\prod^\frac{x}{2\pi^2}_\infty}$",
r"$\sqrt[3]{x}=5$",
r'$\frac{X}{\frac{X}{Y}}$',
# From UTR #25
@@ -56,7 +56,7 @@
def doall():
tests = stests
-
+
figure(figsize=(8, (len(tests) * 1) + 2))
plot([0, 0], 'r')
grid(False)
@@ -69,7 +69,7 @@
savefig('mathtext_examples')
#close('all')
show()
-
+
if '--latex' in sys.argv:
fd = open("mathtext_examples.ltx", "w")
fd.write("\\documentclass{article}\n")
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-01-31 15:21:10 UTC (rev 4911)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-01-31 15:28:29 UTC (rev 4912)
@@ -2641,10 +2641,6 @@
ymin = npy.asarray(ymin)
ymax = npy.asarray(ymax)
- if len(ymin)==1:
- ymin = ymin*npy.ones(x.shape, x.dtype)
- if len(ymax)==1:
- ymax = ymax*npy.ones(x.shape, x.dtype)
if len(ymin)!=len(x):
raise ValueError, 'ymin and x are unequal sized sequences'
@@ -2661,12 +2657,17 @@
self.add_collection(coll)
coll.update(kwargs)
- minx = x.min()
- maxx = x.max()
- miny = min(ymin.min(), ymax.min())
- maxy = max(ymin.max(), ymax.max())
- minx, maxx = self.convert_xunits((minx, maxx))
- miny, maxy = self.convert_yunits((miny, maxy))
+ # We do the conversion first since not all unitized data is uniform
+ xx = self.convert_xunits( x )
+ yymin = self.convert_yunits( ymin )
+ yymax = self.convert_yunits( ymax )
+
+ minx = min( xx )
+ maxx = max( xx )
+
+ miny = min( min(yymin), min(yymax) )
+ maxy = max( max(yymin), max(yymax) )
+
corners = (minx, miny), (maxx, maxy)
self.update_datalim(corners)
self.autoscale_view()
@@ -4165,6 +4166,18 @@
Finally, marker can be (verts, 0), verts is a sequence of (x,y)
vertices for a custom scatter symbol.
+ numsides is the number of sides
+
+ style is the style of the regular symbol:
+ 0 : a regular polygon
+ 1 : a star-like symbol
+ 2 : an asterisk
+
+ angle is the angle of rotation of the symbol
+
+ Finally, marker can be (verts, 0), verts is a sequence of (x,y)
+ vertices for a custom scatter symbol.
+
s is a size argument in points squared.
Any or all of x, y, s, and c may be masked arrays, in which
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-01-31 15:21:10 UTC (rev 4911)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-01-31 15:28:29 UTC (rev 4912)
@@ -2102,12 +2102,7 @@
Suppress(Literal(r"\sqrt"))
+ Optional(
Suppress(Literal("["))
- + Group(
- OneOrMore(
- (c_over_c | symbol)
- ^ font
- )
- )
+ + Regex("[0-9]+")
+ Suppress(Literal("]")),
default = None
)
@@ -2595,11 +2590,7 @@
if root is None:
root = Box(0., 0., 0.)
else:
- if not isinstance(root, ParseResults):
- raise ParseFatalException(
- "Can not parse root of radical. "
- "Only simple symbols are allowed in the root.")
- root = Hlist(root.asList())
+ root = Hlist([Char(x, state) for x in root])
root.shrink()
root.shrink()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|