SF.net SVN: matplotlib: [4756] branches/transforms/lib/matplotlib/backends/ backend_pdf.py
Revision: 4756
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4756&view=rev
Author: mdboom
Date: 2007-12-17 07:41:34 -0800 (Mon, 17 Dec 2007)
Log Message:
---
Bugfix
Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-17
04:37:38 UTC (rev 4755)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-17
15:41:34 UTC (rev 4756)
@@ -399,7 +399,7 @@
self.nextImage = 1
self.markers = {}
-self.two_byte_charprocs = {}
+self.multi_byte_charprocs = {}
# The PDF spec recommends to include every procset
procsets = [ Name(x)
@@ -431,7 +431,7 @@
xobjects = dict(self.images.values())
for tup in self.markers.values():
xobjects[tup[0]] = tup[1]
-for name, value in self.two_byte_charprocs.items():
+for name, value in self.multi_byte_charprocs.items():
xobjects[name] = value
self.writeObject(self.XObjectObject, xobjects)
self.writeImages()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4757] branches/transforms/examples/symlog_demo.py
Revision: 4757
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4757&view=rev
Author: mdboom
Date: 2007-12-17 07:41:47 -0800 (Mon, 17 Dec 2007)
Log Message:
---
Make filename match example.
Modified Paths:
--
branches/transforms/examples/symlog_demo.py
Modified: branches/transforms/examples/symlog_demo.py
===
--- branches/transforms/examples/symlog_demo.py 2007-12-17 15:41:34 UTC (rev
4756)
+++ branches/transforms/examples/symlog_demo.py 2007-12-17 15:41:47 UTC (rev
4757)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from pylab import *
-dt = 1.0
+dt = 0.01
x = arange(-50.0, 50.0, dt)
y = arange(0, 100.0, dt)
@@ -25,5 +25,5 @@
grid(True)
ylabel('symlog both')
-savefig('log_demo')
+savefig('symlog_demo')
show()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4758] branches/transforms
Revision: 4758
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4758&view=rev
Author: mdboom
Date: 2007-12-17 07:43:03 -0800 (Mon, 17 Dec 2007)
Log Message:
---
Merged revisions 4735-4757 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4745 | jdh2358 | 2007-12-15 16:33:38 -0500 (Sat, 15 Dec 2007) | 1 line
changed %g to %r for rec2csv
r4747 | astraw | 2007-12-16 14:28:46 -0500 (Sun, 16 Dec 2007) | 1 line
Add test for rec2csv and csv2rec roundtrip not losing precision.
r4748 | astraw | 2007-12-16 15:53:35 -0500 (Sun, 16 Dec 2007) | 1 line
rec2csv does not close filehandles passed in open
r4749 | astraw | 2007-12-16 18:19:59 -0500 (Sun, 16 Dec 2007) | 1 line
fix csv2rec roundtrip for funky strings, too
r4755 | jdh2358 | 2007-12-16 23:37:38 -0500 (Sun, 16 Dec 2007) | 1 line
mods to support dates in csv2rec and friends
Modified Paths:
--
branches/transforms/CHANGELOG
branches/transforms/lib/matplotlib/cbook.py
branches/transforms/lib/matplotlib/mlab.py
branches/transforms/lib/matplotlib/mpl-data/matplotlib.conf.template
Added Paths:
---
branches/transforms/unit/mlab_unit.py
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4734
+ /trunk/matplotlib:1-4757
Modified: branches/transforms/CHANGELOG
===
--- branches/transforms/CHANGELOG 2007-12-17 15:41:47 UTC (rev 4757)
+++ branches/transforms/CHANGELOG 2007-12-17 15:43:03 UTC (rev 4758)
@@ -1,3 +1,6 @@
+2007-12-16 rec2csv saves doubles without losing precision. Also, it
+ does not close filehandles passed in open. - JDH,ADS
+
2007-12-13 Moved rec2gtk to matplotlib.toolkits.gtktools and rec2excel
to matplotlib.toolkits.exceltools - JDH
Modified: branches/transforms/lib/matplotlib/cbook.py
===
--- branches/transforms/lib/matplotlib/cbook.py 2007-12-17 15:41:47 UTC (rev
4757)
+++ branches/transforms/lib/matplotlib/cbook.py 2007-12-17 15:43:03 UTC (rev
4758)
@@ -225,7 +225,7 @@
except TypeError: return False
else: return True
-def to_filehandle(fname, flag='r'):
+def to_filehandle(fname, flag='r', return_opened=False):
"""
fname can be a filename or a file handle. Support for gzipped
files is automatic, if the filename ends in .gz. flag is a
@@ -237,10 +237,14 @@
fh = gzip.open(fname, flag)
else:
fh = file(fname, flag)
+opened = True
elif hasattr(fname, 'seek'):
fh = fname
+opened = False
else:
raise ValueError('fname must be a string or file handle')
+if return_opened:
+return fh, opened
return fh
def flatten(seq, scalarp=is_scalar):
Modified: branches/transforms/lib/matplotlib/mlab.py
===
--- branches/transforms/lib/matplotlib/mlab.py 2007-12-17 15:41:47 UTC (rev
4757)
+++ branches/transforms/lib/matplotlib/mlab.py 2007-12-17 15:43:03 UTC (rev
4758)
@@ -2129,6 +2129,7 @@
process_skiprows(reader)
+dateparser = dateutil.parser.parse
def myfloat(x):
if x==missing:
@@ -2136,9 +2137,18 @@
else:
return float(x)
+def mydate(x):
+# try and return a date object
+d = dateparser(x)
+
+if d.hour>0 or d.minute>0 or d.second>0:
+raise ValueError('not a date')
+return d.date()
+
+
def get_func(item, func):
# promote functions in this order
-funcmap = {int:myfloat, myfloat:dateutil.parser.parse,
dateutil.parser.parse:str}
+funcmap = {int:myfloat, myfloat:mydate, mydate:dateparser,
dateparser:str}
try: func(item)
except:
if func==str:
@@ -2238,8 +2248,12 @@
class FormatString(FormatObj):
def tostr(self, x):
-return '"%s"'%self.toval(x)
+val = repr(x)
+return val[1:-1]
+#class FormatString(FormatObj):
+#def tostr(self, x):
+#return '"%r"'%self.toval(x)
class FormatFormatStr(FormatObj):
def __init__(self, fmt):
@@ -2297,7 +2311,7 @@
npy.float32 : FormatFloat(),
npy.float64 : FormatFloat(),
npy.object_ : FormatObj(),
-npy.string_ : FormatObj(),
+npy.string_ : FormatString(),
}
def get_formatd(r, formatd=None):
@@ -2317,7 +2331,7 @@
format = copy.deepcopy(format)
if isinstance(format, FormatFloat):
format.scale = 1. # override scaling for storage
-format.fmt = '%g' # maximal precision
+format.fmt = '%r'
return format
def rec2csv(r, fname, delimiter=',', formatd=None):
@@ -23
SF.net SVN: matplotlib: [4759] trunk/toolkits/basemap/examples/plotsst.py
Revision: 4759
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4759&view=rev
Author: jswhit
Date: 2007-12-17 09:20:29 -0800 (Mon, 17 Dec 2007)
Log Message:
---
fix typo
Modified Paths:
--
trunk/toolkits/basemap/examples/plotsst.py
Modified: trunk/toolkits/basemap/examples/plotsst.py
===
--- trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 15:43:03 UTC (rev
4758)
+++ trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 17:20:29 UTC (rev
4759)
@@ -7,7 +7,7 @@
date = '20071215'
else:
date = sys.argv[1]
-if date[4] > '2005':
+if date[0:4] > '2005':
ncfile =
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc')
else:
ncfile =
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc')
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4760] branches/transforms/lib/matplotlib/scale.py
Revision: 4760
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4760&view=rev
Author: mdboom
Date: 2007-12-17 10:28:03 -0800 (Mon, 17 Dec 2007)
Log Message:
---
Added Mercator latitude scale.
Modified Paths:
--
branches/transforms/lib/matplotlib/scale.py
Modified: branches/transforms/lib/matplotlib/scale.py
===
--- branches/transforms/lib/matplotlib/scale.py 2007-12-17 17:20:29 UTC (rev
4759)
+++ branches/transforms/lib/matplotlib/scale.py 2007-12-17 18:28:03 UTC (rev
4760)
@@ -2,8 +2,8 @@
from matplotlib.numerix import npyma as ma
MaskedArray = ma.MaskedArray
-from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext
-from ticker import NullLocator, LogLocator, AutoLocator, SymmetricalLogLocator
+from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext,
Formatter
+from ticker import NullLocator, LogLocator, AutoLocator,
SymmetricalLogLocator, FixedLocator
from transforms import Transform, IdentityTransform
class ScaleBase(object):
@@ -28,6 +28,7 @@
def get_transform(self):
return IdentityTransform()
+
def _mask_non_positives(a):
mask = a <= 0.0
if mask.any():
@@ -185,7 +186,17 @@
return (vmin <= 0.0 and minpos or vmin,
vmax <= 0.0 and minpos or vmax)
+
class SymmetricalLogScale(ScaleBase):
+"""
+The symmetrical logarithmic scale is logarithmic in both the
+positive and negative directions from the origin.
+
+Since the values close to zero tend toward infinity, there is
+usually need to have a range around zero that is linear. The
+parameter "linthresh" allows the user to specify the size of this
+range (-linthresh, linthresh).
+"""
name = 'symlog'
class SymmetricalLogTransform(Transform):
@@ -263,10 +274,83 @@
return self._transform
+class MercatorLatitudeScale(ScaleBase):
+"""
+Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using
+the system used to scale latitudes in a Mercator projection.
+
+The scale function:
+ ln(tan(y) + sec(y))
+
+The inverse scale function:
+ atan(sinh(y))
+
+source:
+http://en.wikipedia.org/wiki/Mercator_projection
+"""
+name = 'mercator_latitude'
+
+class MercatorLatitudeTransform(Transform):
+input_dims = 1
+output_dims = 1
+is_separable = True
+
+def __init__(self, thresh):
+Transform.__init__(self)
+self.thresh = thresh
+
+def transform(self, a):
+masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a)
+return ma.log(ma.tan(masked) + 1.0 / ma.cos(masked))
+
+def inverted(self):
+return MercatorLatitudeScale.InvertedMercatorLatitudeTransform()
+
+class InvertedMercatorLatitudeTransform(Transform):
+input_dims = 1
+output_dims = 1
+is_separable = True
+
+def transform(self, a):
+return npy.arctan(npy.sinh(a))
+
+def inverted(self):
+return MercatorLatitudeScale.MercatorLatitudeTransform()
+
+def __init__(self, axis, **kwargs):
+thresh = kwargs.pop("thresh", (85 / 180.0) * npy.pi)
+if thresh >= npy.pi / 2.0:
+raise ValueError("thresh must be less than pi/2")
+self.thresh = thresh
+self._transform = self.MercatorLatitudeTransform(thresh)
+
+def set_default_locators_and_formatters(self, axis):
+class ThetaFormatter(Formatter):
+"""
+Used to format the theta tick labels. Converts the native
+unit of radians into degrees and adds a degree symbol.
+"""
+def __call__(self, x, pos=None):
+# \u00b0 : degree symbol
+return u"%d\u00b0" % ((x / npy.pi) * 180.0)
+
+deg2rad = npy.pi / 180.0
+axis.set_major_locator(FixedLocator(
+npy.arange(-90, 90, 10) * deg2rad))
+axis.set_major_formatter(ThetaFormatter())
+axis.set_minor_formatter(ThetaFormatter())
+
+def get_transform(self):
+return self._transform
+
+def limit_range_for_scale(self, vmin, vmax, minpos):
+return max(vmin, -self.thresh), min(vmax, self.thresh)
+
_scale_mapping = {
-'linear': LinearScale,
-'log' : LogScale,
-'symlog': SymmetricalLogScale
+'linear': LinearScale,
+'log' : LogScale,
+'symlog': SymmetricalLogScale,
+'mercator_latitude' : MercatorLatitudeScale
}
def scale_factory(scale, axis, **kwargs):
scale = scale.lower()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best pla
SF.net SVN: matplotlib: [4761] branches/transforms/lib/matplotlib/ projections/polar.py
Revision: 4761 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4761&view=rev Author: mdboom Date: 2007-12-17 10:29:04 -0800 (Mon, 17 Dec 2007) Log Message: --- Minor speed improvement Modified Paths: -- branches/transforms/lib/matplotlib/projections/polar.py Modified: branches/transforms/lib/matplotlib/projections/polar.py === --- branches/transforms/lib/matplotlib/projections/polar.py 2007-12-17 18:28:03 UTC (rev 4760) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-12-17 18:29:04 UTC (rev 4761) @@ -310,7 +310,7 @@ ACCEPTS: sequence of floats """ angles = npy.asarray(angles, npy.float_) -self.set_xticks((angles / 180.0) * npy.pi) +self.set_xticks(angles * (npy.pi / 180.0)) if labels is not None: self.set_xticklabels(labels) if frac is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
