SF.net SVN: matplotlib: [4612] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/netcdftime.py
Revision: 4612 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4612&view=rev Author: jswhit Date: 2007-12-05 05:59:10 -0800 (Wed, 05 Dec 2007) Log Message: --- fixed time zone offset bug in num2date. Modified Paths: -- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py === --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py 2007-12-05 13:11:58 UTC (rev 4611) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py 2007-12-05 13:59:10 UTC (rev 4612) @@ -703,11 +703,11 @@ shape = time_value.shape # convert to desired units, remove time zone offset. if self.units in ['second','seconds']: -jdelta = time_value/86400. - self.tzoffset*60 +jdelta = time_value/86400. - self.tzoffset/1440. elif self.units in ['minute','minutes']: -jdelta = time_value/1440. - self.tzoffset +jdelta = time_value/1440. - self.tzoffset/1440. elif self.units in ['hours','hours']: -jdelta = time_value/24. - self.tzoffset/60. +jdelta = time_value/24. - self.tzoffset/1440. elif self.units in ['day','days']: jdelta = time_value - self.tzoffset/1440. jd = self._jd0 + jdelta This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4613] trunk
Revision: 4613 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4613&view=rev Author: dsdale Date: 2007-12-05 06:45:56 -0800 (Wed, 05 Dec 2007) Log Message: --- removed .cvsignore files, they are not needed Removed Paths: - trunk/course/.cvsignore trunk/course/code/.cvsignore trunk/course/examples/.cvsignore trunk/course/fig/.cvsignore trunk/htdocs/.cvsignore trunk/htdocs/examples/.cvsignore trunk/htdocs/screenshots/.cvsignore trunk/matplotlib/.cvsignore trunk/matplotlib/examples/.cvsignore trunk/matplotlib/lib/matplotlib/.cvsignore trunk/matplotlib/lib/matplotlib/backends/.cvsignore trunk/matplotlib/lib/matplotlib/numerix/.cvsignore trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore trunk/users_guide/.cvsignore trunk/users_guide/data/.cvsignore trunk/users_guide/figures/.cvsignore trunk/users_guide/styles/.cvsignore Deleted: trunk/course/.cvsignore === --- trunk/course/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/course/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,10 +0,0 @@ -*.bbl -*.blg -*.dvi -*.log -*.toc -*.aux -*.out -*.tex -*.pdf -auto \ No newline at end of file Deleted: trunk/course/code/.cvsignore === --- trunk/course/code/.cvsignore2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/course/code/.cvsignore2007-12-05 14:45:56 UTC (rev 4613) @@ -1,2 +0,0 @@ -*.pyc -*~ \ No newline at end of file Deleted: trunk/course/examples/.cvsignore === --- trunk/course/examples/.cvsignore2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/course/examples/.cvsignore2007-12-05 14:45:56 UTC (rev 4613) @@ -1,2 +0,0 @@ -*.pyc -*~ Deleted: trunk/course/fig/.cvsignore === --- trunk/course/fig/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/course/fig/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1 +0,0 @@ -.xvpics \ No newline at end of file Deleted: trunk/htdocs/.cvsignore === --- trunk/htdocs/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/htdocs/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,5 +0,0 @@ -*.pyc -*html -site.tar.gz -drafts -.cvsignore \ No newline at end of file Deleted: trunk/htdocs/examples/.cvsignore === --- trunk/htdocs/examples/.cvsignore2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/htdocs/examples/.cvsignore2007-12-05 14:45:56 UTC (rev 4613) @@ -1,6 +0,0 @@ -*.png -*.ps -*.eps -*.jpg -*.pyc -.cvsignore \ No newline at end of file Deleted: trunk/htdocs/screenshots/.cvsignore === --- trunk/htdocs/screenshots/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/htdocs/screenshots/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,4 +0,0 @@ -*.png -.cvsignore -.xvpics -*.pyc \ No newline at end of file Deleted: trunk/matplotlib/.cvsignore === --- trunk/matplotlib/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/matplotlib/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,6 +0,0 @@ -build -dist -docs -*.pyc -.project -matplotlibrc Deleted: trunk/matplotlib/examples/.cvsignore === --- trunk/matplotlib/examples/.cvsignore2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/matplotlib/examples/.cvsignore2007-12-05 14:45:56 UTC (rev 4613) @@ -1,8 +0,0 @@ -*.eps -*.jpeg -*.jpg -*.pdf -*.png -*.ps -*.pyc -*.svg Deleted: trunk/matplotlib/lib/matplotlib/.cvsignore === --- trunk/matplotlib/lib/matplotlib/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/matplotlib/lib/matplotlib/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,2 +0,0 @@ -*.pyc -.cvsignore \ No newline at end of file Deleted: trunk/matplotlib/lib/matplotlib/backends/.cvsignore === --- trunk/matplotlib/lib/matplotlib/backends/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/matplotlib/lib/matplotlib/backends/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,2 +0,0 @@ -*.pyc -.cvsignore \ No newline at end of file Deleted: trunk/matplotlib/lib/matplotlib/numerix/.cvsignore === --- trunk/matplotlib/lib/matplotlib/numerix/.cvsignore 2007-12-05 13:59:10 UTC (rev 4612) +++ trunk/matplotlib/lib/matplotlib/numerix/.cvsignore 2007-12-05 14:45:56 UTC (rev 4613) @@ -1,2 +0,0 @@ -*.pyc -.cvsignore \ No newline at end of file Deleted: trunk/matplotlib
SF.net SVN: matplotlib: [4615] branches/transforms
Revision: 4615
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4615&view=rev
Author: mdboom
Date: 2007-12-05 07:36:48 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Make new auto-layout stuff optional (so it can be experimented on
without breaking too much.)
Modified Paths:
--
branches/transforms/examples/simple_plot.py
branches/transforms/lib/matplotlib/figure.py
branches/transforms/lib/matplotlib/rcsetup.py
Modified: branches/transforms/examples/simple_plot.py
===
--- branches/transforms/examples/simple_plot.py 2007-12-05 15:16:48 UTC (rev
4614)
+++ branches/transforms/examples/simple_plot.py 2007-12-05 15:36:48 UTC (rev
4615)
@@ -13,9 +13,6 @@
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
-axes().xaxis.set_label_position('top')
-axes().xaxis.set_ticks_position('top')
-axes().yaxis.set_label_position('right')
#savefig('simple_plot.png')
savefig('simple_plot')
Modified: branches/transforms/lib/matplotlib/figure.py
===
--- branches/transforms/lib/matplotlib/figure.py2007-12-05 15:16:48 UTC
(rev 4614)
+++ branches/transforms/lib/matplotlib/figure.py2007-12-05 15:36:48 UTC
(rev 4615)
@@ -151,6 +151,7 @@
self.clf()
self._cachedRenderer = None
+self._autoLayout = False
def _get_dpi(self):
return self._dpi
@@ -159,6 +160,9 @@
self._dpi_scale_trans.clear().scale(dpi, dpi)
dpi = property(_get_dpi, _set_dpi)
+def enable_auto_layout(self, setting=True):
+self._autoLayout = setting
+
def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
"""
A common use case is a number of subplots with shared xaxes
@@ -628,8 +632,9 @@
# based on the tick and axis labels etc., and then makes sure
# that any axes that began life aligned to another axes remains
# aligned after these adjustments
-if len(self.axes) > 1:
+if self._autoLayout and len(self.axes) > 1:
aligned_positions = [{}, {}, {}, {}]
+sizes = [{}, {}]
for a in self.axes:
a.update_layout(renderer)
orig_pos = a.get_position(True)
@@ -642,6 +647,15 @@
pos[orig][1].add(curr)
else:
pos[orig] = [[a], set([curr])]
+for size, orig, curr in zip(sizes,
+orig_pos.size,
+curr_pos.size):
+orig = round(orig * 100.0) / 100.0
+if orig in size:
+size[orig][0].append(a)
+size[orig][1].add(curr)
+else:
+size[orig] = [[a], set([curr])]
for i, pos in enumerate(aligned_positions):
for axes, places in pos.values():
@@ -654,7 +668,19 @@
curr_pos = a.get_position().frozen()
curr_pos.get_points()[i/2, i%2] = curr
a.set_position(curr_pos, 'active')
-else:
+
+for i, size in enumerate(sizes):
+for axes, dims in size.values():
+new = min(dims)
+for a in axes:
+curr_pos = a.get_position().frozen()
+curr = curr_pos.size[i]
+if curr > new:
+extra = (curr - new) * 0.5
+curr_pos.get_points()[0, i] += extra
+curr_pos.get_points()[1, i] -= extra
+a.set_position(curr_pos, 'active')
+elif self._autoLayout:
for a in self.axes: a.update_layout(renderer)
# render the axes
Modified: branches/transforms/lib/matplotlib/rcsetup.py
===
--- branches/transforms/lib/matplotlib/rcsetup.py 2007-12-05 15:16:48 UTC
(rev 4614)
+++ branches/transforms/lib/matplotlib/rcsetup.py 2007-12-05 15:36:48 UTC
(rev 4615)
@@ -440,12 +440,12 @@
'figure.facecolor' : [ '0.75', validate_color], # facecolor; scalar gray
'figure.edgecolor' : [ 'w', validate_color], # edgecolor; white
-'figure.subplot.left' : [0.1, ValidateInterval(0, 1, closedmin=False,
closedmax=False)],
+'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.1, V
SF.net SVN: matplotlib: [4617] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/netcdftime.py
Revision: 4617
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4617&view=rev
Author: jswhit
Date: 2007-12-05 07:40:46 -0800 (Wed, 05 Dec 2007)
Log Message:
---
docstring reformatting
Modified Paths:
--
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
2007-12-05 15:39:39 UTC (rev 4616)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
2007-12-05 15:40:46 UTC (rev 4617)
@@ -571,7 +571,7 @@
it is divisible by 400.
- C{'noleap'} or C{'365_day'}:
Gregorian calendar without leap years, i.e., all years are 365 days long.
- - C{all_leap} or C{'366_day'}:
+ - C{'all_leap'} or C{'366_day'}:
Gregorian calendar with every year being a leap year, i.e.,
all years are 366 days long.
-C{'360_day'}:
@@ -690,8 +690,8 @@
the date is after 1582-10-15). Otherwise, they are 'phony' datetime
objects which are actually instances of netcdftime.datetime. This is
because the python datetime module cannot handle the weird dates in some
-calendars (such as C{'360_day'} and C{'all_leap'}) which don't exist in any
real
-world calendar.
+calendars (such as C{'360_day'} and C{'all_leap'}) which
+do not exist in any real world calendar.
"""
isscalar = False
try:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4614] trunk/matplotlib
Revision: 4614
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4614&view=rev
Author: jdh2358
Date: 2007-12-05 07:16:48 -0800 (Wed, 05 Dec 2007)
Log Message:
---
exposed default color cycle
Modified Paths:
--
trunk/matplotlib/API_CHANGES
trunk/matplotlib/lib/matplotlib/__init__.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/image.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/API_CHANGES
===
--- trunk/matplotlib/API_CHANGES2007-12-05 14:45:56 UTC (rev 4613)
+++ trunk/matplotlib/API_CHANGES2007-12-05 15:16:48 UTC (rev 4614)
@@ -1,3 +1,5 @@
+Removed, dead/experimental ExampleInfo, Namespace and Importer
+code from matplotlib/__init__.py
0.91.1 Released
0.91.0 Released
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===
--- trunk/matplotlib/lib/matplotlib/__init__.py 2007-12-05 14:45:56 UTC (rev
4613)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-12-05 15:16:48 UTC (rev
4614)
@@ -55,7 +55,7 @@
"""
from __future__ import generators
-__version__ = '0.91.1'
+__version__ = '0.91.2svn'
__revision__ = '$Revision$'
__date__ = '$Date$'
@@ -784,60 +784,3 @@
verbose.report('platform is %s'%sys.platform)
verbose.report('loaded modules: %s'%sys.modules.keys(), 'debug')
-class ExampleInfo:
-pass
-
-class ExampleManager:
-baseurl = 'http://matplotlib.sf.net'
-urls = ['%s/%s'%(baseurl, subdir) for subdir in
-( 'examples', 'examples/widgets')]
-
-def get_examples(self):
-import urllib, re
-rgx = re.compile('.*.*')
-examples = []
-for url in urls:
-lines = urllib.urlopen(url).readlines()
-for line in lines:
-m = rgx.match(line)
-if m is not None:
-examples.append('%s/%s'%(url, m.group(1)))
-return examples
-
-def get_info(self, s):
-"""
-return an ExampleInfo instance from s, the string content of
-an example
-"""
-pass
-
-class Namespace:
-"""
-A class which takes a list of modules and creates an object with
-the module naems at attrs
-"""
-def __init__(self, namespace):
-for k,v in namespace.items():
-modname = getattr(v, '__name__', None)
-if modname is None: continue
-if modname.startswith('matplotlib.'):
-self.__dict__[modname.replace('matplotlib.', '')] = v
-
-
-class Importer:
-def __init__(self, modstr):
-"""
-import a bunch of matplotlib modules listed in modstr into a
-single namespace. Eg,
-
-mpl = Importer('artist, cbook, lines, patches')
-print mpl.cbook.iterable(1)
-"""
-for name in modstr.split(','):
-name = name.strip()
-wholename = '.'.join(['matplotlib', name])
-basemod = __import__(wholename)
-mod = getattr(basemod, name)
-setattr(self, name, mod)
-
-
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===
--- trunk/matplotlib/lib/matplotlib/axes.py 2007-12-05 14:45:56 UTC (rev
4613)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2007-12-05 15:16:48 UTC (rev
4614)
@@ -152,13 +152,14 @@
an arbitrary number of x, y, fmt are allowed
"""
+defaultColors = ['b','g','r','c','m','y','k']
def __init__(self, axes, command='plot'):
self.axes = axes
self.command = command
self._clear_color_cycle()
def _clear_color_cycle(self):
-self.colors = ['b','g','r','c','m','y','k']
+self.colors = _process_plot_var_args.defaultColors[:]
# if the default line color is a color format string, move it up
# in the que
try: ind = self.colors.index(rcParams['lines.color'])
Modified: trunk/matplotlib/lib/matplotlib/image.py
===
--- trunk/matplotlib/lib/matplotlib/image.py2007-12-05 14:45:56 UTC (rev
4613)
+++ trunk/matplotlib/lib/matplotlib/image.py2007-12-05 15:16:48 UTC (rev
4614)
@@ -243,6 +243,8 @@
self.set_data(A)
+
+
def set_extent(self, extent):
"""extent is data axes (left, right, bottom, top) for making image
plots
"""
Modified: trunk/matplotlib/matplotlibrc.template
===
--- trunk/matplotlib/matplotlibrc.template 2007-12-05 14:45:56 UTC (rev
4613)
+++ trunk/matplotlib/matplotlibrc.template 2007-12-05 15:16:48 UTC (rev
4614)
@@ -25,7 +25,7 @@
CONFIGURATION BEGINS HERE
# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
-# Agg Cairo GD GDK Paint PS PDF SVG Template
+# WX
SF.net SVN: matplotlib: [4623] trunk/toolkits/basemap/examples/fcstmaps.py
Revision: 4623
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4623&view=rev
Author: jswhit
Date: 2007-12-05 09:25:34 -0800 (Wed, 05 Dec 2007)
Log Message:
---
simplify time/date handling
Modified Paths:
--
trunk/toolkits/basemap/examples/fcstmaps.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===
--- trunk/toolkits/basemap/examples/fcstmaps.py 2007-12-05 17:11:28 UTC (rev
4622)
+++ trunk/toolkits/basemap/examples/fcstmaps.py 2007-12-05 17:25:34 UTC (rev
4623)
@@ -37,14 +37,15 @@
fcsttimes = data.variables['time']
times = fcsttimes[0:6] # first 6 forecast times.
ntimes = len(times)
-# put forecast times in MMDDHH format.
-verifdates = []
-fcsthrs=[]
-for time in times:
-print time, times[0]
-fcsthrs.append(int((time-times[0])*24))
-fdate = num2date(time,fcsttimes.units)
-verifdates.append(fdate.strftime('%Y%m%d%H'))
+# convert times for datetime instances.
+fdates = num2date(times,fcsttimes.units)
+# make a list of MMDDHH strings.
+verifdates = [fdate.strftime('%Y%m%d%H') for fdate in fdates]
+# convert times to forecast hours.
+fcsthrs = []
+for fdate in fdates:
+fdiff = fdate-fdates[0]
+fcsthrs.append(fdiff.days*24. + fdiff.seconds/3600.)
print fcsthrs
print verifdates
lats = latitudes[:]
@@ -79,7 +80,7 @@
m.drawparallels(numpy.arange(-80,81,20))
m.drawmeridians(numpy.arange(0,360,20))
# panel title
-title(repr(fcsthr)+'-h forecast valid '+verifdates[nt],fontsize=9)
+title('%d-h forecast valid '%fcsthr+verifdates[nt],fontsize=9)
# figure title
figtext(0.5,0.95,u"2-m temp (\N{DEGREE SIGN}C) forecasts from
%s"%verifdates[0],
horizontalalignment='center',fontsize=14)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4627] branches/transforms/lib/matplotlib/mathtext. py
Revision: 4627
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4627&view=rev
Author: mdboom
Date: 2007-12-05 10:57:06 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Prevent mathtext cache from getting out of hand.
Modified Paths:
--
branches/transforms/lib/matplotlib/mathtext.py
Modified: branches/transforms/lib/matplotlib/mathtext.py
===
--- branches/transforms/lib/matplotlib/mathtext.py 2007-12-05 18:56:42 UTC
(rev 4626)
+++ branches/transforms/lib/matplotlib/mathtext.py 2007-12-05 18:57:06 UTC
(rev 4627)
@@ -151,7 +151,7 @@
from matplotlib.afm import AFM
from matplotlib.cbook import Bunch, get_realpath_and_stat, \
-is_string_like
+is_string_like, maxdict
from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT,
LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING
from matplotlib.font_manager import findfont, FontProperties
from matplotlib._mathtext_data import latex_to_bakoma, \
@@ -2656,7 +2656,7 @@
def __init__(self, output):
self._output = output
-self._cache = {}
+self._cache = maxdict(50)
def parse(self, s, dpi = 72, prop = None):
if prop is 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: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4632] trunk/matplotlib/examples/coords_report.py
Revision: 4632 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4632&view=rev Author: pkienzle Date: 2007-12-05 11:36:36 -0800 (Wed, 05 Dec 2007) Log Message: --- docu update: coord reporting works in wx Modified Paths: -- trunk/matplotlib/examples/coords_report.py Modified: trunk/matplotlib/examples/coords_report.py === --- trunk/matplotlib/examples/coords_report.py 2007-12-05 19:30:21 UTC (rev 4631) +++ trunk/matplotlib/examples/coords_report.py 2007-12-05 19:36:36 UTC (rev 4632) @@ -1,7 +1,6 @@ #!/usr/bin/env python -# override the default reporting of coords (coords reporting not -# implemented yet on wx*) +# override the default reporting of coords from pylab import * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4624] branches/transforms
Revision: 4624
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4624&view=rev
Author: mdboom
Date: 2007-12-05 10:14:38 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Make autolayout a configuration option.
Modified Paths:
--
branches/transforms/lib/matplotlib/axes.py
branches/transforms/lib/matplotlib/config/mplconfig.py
branches/transforms/lib/matplotlib/config/rcsetup.py
branches/transforms/lib/matplotlib/figure.py
branches/transforms/lib/matplotlib/rcsetup.py
branches/transforms/matplotlibrc.template
Modified: branches/transforms/lib/matplotlib/axes.py
===
--- branches/transforms/lib/matplotlib/axes.py 2007-12-05 17:25:34 UTC (rev
4623)
+++ branches/transforms/lib/matplotlib/axes.py 2007-12-05 18:14:38 UTC (rev
4624)
@@ -802,7 +802,7 @@
self.xaxis.set_clip_path(self.axesPatch)
self.yaxis.set_clip_path(self.axesPatch)
-self.titleOffsetTrans.clear()
+self.titleOffsetTrans.clear().translate(0.0, 10.0)
def clear(self):
'clear the axes'
Modified: branches/transforms/lib/matplotlib/config/mplconfig.py
===
--- branches/transforms/lib/matplotlib/config/mplconfig.py 2007-12-05
17:25:34 UTC (rev 4623)
+++ branches/transforms/lib/matplotlib/config/mplconfig.py 2007-12-05
18:14:38 UTC (rev 4624)
@@ -238,6 +238,7 @@
dpi = T.Float(80)
facecolor = T.Trait('0.75', mplT.ColorHandler())
edgecolor = T.Trait('white', mplT.ColorHandler())
+autolayout = T.false
class subplot(TConfig):
"""The figure subplot parameters. All dimensions are fraction
@@ -415,6 +416,7 @@
'figure.subplot.wspace' : (self.tconfig.figure.subplot, 'wspace'),
'figure.subplot.hspace' : (self.tconfig.figure.subplot, 'hspace'),
+'figure.autolayout' : (self.tconfig.figure, 'autolayout'),
'savefig.dpi' : (self.tconfig.savefig, 'dpi'),
'savefig.facecolor' : (self.tconfig.savefig, 'facecolor'),
Modified: branches/transforms/lib/matplotlib/config/rcsetup.py
===
--- branches/transforms/lib/matplotlib/config/rcsetup.py2007-12-05
17:25:34 UTC (rev 4623)
+++ branches/transforms/lib/matplotlib/config/rcsetup.py2007-12-05
18:14:38 UTC (rev 4624)
@@ -447,6 +447,7 @@
'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.autolayout' : [False, validate_bool], # autolayout
'savefig.dpi' : [100, validate_float], # DPI
'savefig.facecolor' : ['w', validate_color], # facecolor; white
Modified: branches/transforms/lib/matplotlib/figure.py
===
--- branches/transforms/lib/matplotlib/figure.py2007-12-05 17:25:34 UTC
(rev 4623)
+++ branches/transforms/lib/matplotlib/figure.py2007-12-05 18:14:38 UTC
(rev 4624)
@@ -151,7 +151,7 @@
self.clf()
self._cachedRenderer = None
-self._autoLayout = False
+self._autoLayout = rcParams['figure.autolayout']
def _get_dpi(self):
return self._dpi
@@ -185,7 +185,8 @@
else:
for label in ax.get_xticklabels():
label.set_visible(False)
-#self.subplots_adjust(bottom=bottom)
+if not self._autoLayout:
+self.subplots_adjust(bottom=bottom)
def get_children(self):
'get a list of artists contained in the figure'
Modified: branches/transforms/lib/matplotlib/rcsetup.py
===
--- branches/transforms/lib/matplotlib/rcsetup.py 2007-12-05 17:25:34 UTC
(rev 4623)
+++ branches/transforms/lib/matplotlib/rcsetup.py 2007-12-05 18:14:38 UTC
(rev 4624)
@@ -447,6 +447,7 @@
'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.autolayout' : [False, validate_bool],
'savefig.dpi' : [100, validate_float], # DPI
'savefig.facecolor' : ['w', validate_color], # facecolor; white
Modified: branches/transforms/matplotlibrc.template
===
--- branches/transforms/matplotlibrc.template 2007-12-05 17:25:34 UTC (rev
4623)
+++ branches/transforms/matplotlibrc.template 2007-12-05 18:14:38 UTC (rev
4624)
@@ -156,7 +156,7 @@
# 'tex': As TeX-like text. Text between $'s
will be
# formatted as a TeX math expression.
# This setting has no
SF.net SVN: matplotlib: [4622] trunk/matplotlib/lib/matplotlib/figure.py
Revision: 4622
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4622&view=rev
Author: jdh2358
Date: 2007-12-05 09:11:28 -0800 (Wed, 05 Dec 2007)
Log Message:
---
updated autofmt_xdate to work in more cases. it no longer raises if axes
aren't subplots
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===
--- trunk/matplotlib/lib/matplotlib/figure.py 2007-12-05 16:38:01 UTC (rev
4621)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2007-12-05 17:11:28 UTC (rev
4622)
@@ -164,12 +164,14 @@
def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
"""
-A common use case is a number of subplots with shared xaxes
-where the x-axis is date data. The ticklabels are often
-long,and it helps to rotate them on the bottom subplot and
-turn them off on other subplots. This function will raise a
-RuntimeError if any of the Axes are not Subplots.
+Date ticklabels often overlap, so it is useful to rotate them
+and right align them. Also, a common use case is a number of
+subplots with shared xaxes where the x-axis is date data. The
+ticklabels are often long, and it helps to rotate them on the
+bottom subplot and turn them off on other subplots, as well as
+turn off xlabels.
+
bottom : the bottom of the subplots for subplots_adjust
rotation: the rotation of the xtick labels
ha : the horizontal alignment of the xticklabels
@@ -177,18 +179,26 @@
"""
-for ax in self.get_axes():
-if not hasattr(ax, 'is_last_row'):
-raise RuntimeError('Axes must be subplot instances; found
%s'%type(ax))
-if ax.is_last_row():
-for label in ax.get_xticklabels():
-label.set_ha(ha)
-label.set_rotation(rotation)
-else:
-for label in ax.get_xticklabels():
-label.set_visible(False)
-self.subplots_adjust(bottom=bottom)
+allsubplots = npy.alltrue([hasattr(ax, 'is_last_row') for ax in
self.axes])
+if len(self.axes)==1:
+for label in ax.get_xticklabels():
+label.set_ha(ha)
+label.set_rotation(rotation)
+else:
+if allsubplots:
+for ax in self.get_axes():
+if ax.is_last_row():
+for label in ax.get_xticklabels():
+label.set_ha(ha)
+label.set_rotation(rotation)
+else:
+for label in ax.get_xticklabels():
+label.set_visible(False)
+ax.set_xlabel('')
+if allsubplots:
+self.subplots_adjust(bottom=bottom)
+
def get_children(self):
'get a list of artists contained in the figure'
children = [self.figurePatch]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4629] trunk/matplotlib
Revision: 4629 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4629&view=rev Author: jdh2358 Date: 2007-12-05 11:27:14 -0800 (Wed, 05 Dec 2007) Log Message: --- minor rec2excel enhancements Modified Paths: -- trunk/matplotlib/examples/loadrec.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/examples/loadrec.py === --- trunk/matplotlib/examples/loadrec.py2007-12-05 18:57:54 UTC (rev 4628) +++ trunk/matplotlib/examples/loadrec.py2007-12-05 19:27:14 UTC (rev 4629) @@ -9,4 +9,6 @@ ax = fig.add_subplot(111) ax.plot(a.date, a.adj_close, '-') fig.autofmt_xdate() + +mlab.rec2excel(a, 'test.xls', colnum=4) show() Modified: trunk/matplotlib/lib/matplotlib/mlab.py === --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-05 18:57:54 UTC (rev 4628) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-05 19:27:14 UTC (rev 4629) @@ -2367,7 +2367,7 @@ xlstyle.num_format_str = '#,##;[RED]-#,##' elif isinstance(format, FormatPercent): zeros = ''.join(['0']*format.precision) -xlstyle.num_format_str = '0.%s%;[RED]-0.%s%'%(zeros, zeros) +xlstyle.num_format_str = '0.%s%%;[RED]-0.%s%%'%(zeros, zeros) format.scale = 1. else: xlstyle = None @@ -2376,12 +2376,14 @@ return format -def rec2excel(r, ws, formatd=None, rownum=0): +def rec2excel(r, ws, formatd=None, rownum=0, colnum=0): """ save record array r to excel pyExcelerator worksheet ws starting at rownum. if ws is string like, assume it is a filename and save to it +start writing at rownum, colnum + formatd is a dictionary mapping dtype name -> FormatXL instances The next rownum after writing is returned @@ -2399,6 +2401,12 @@ formatd = dict() formats = [] +font = excel.Font() +font.bold = True + +stylehdr = excel.XFStyle() +stylehdr.font = font + for i, name in enumerate(r.dtype.names): dt = r.dtype[name] format = formatd.get(name) @@ -2406,7 +2414,7 @@ format = defaultformatd.get(dt.type, FormatObj()) format = xlformat_factory(format) -ws.write(rownum, i, name) +ws.write(rownum, colnum+i, name, stylehdr) formats.append(format) rownum+=1 @@ -2419,12 +2427,12 @@ format = formats[i] val = format.toval(val) if format.xlstyle is None: -ws.write(rownum, i, val) +ws.write(rownum, colnum+i, val) else: if safe_isnan(val): -ws.write(rownum, i, 'NaN') +ws.write(rownum, colnum+i, 'NaN') else: -ws.write(rownum, i, val, format.xlstyle) +ws.write(rownum, colnum+i, val, format.xlstyle) rownum += 1 if autosave: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4630] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py
Revision: 4630 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4630&view=rev Author: jswhit Date: 2007-12-05 11:28:39 -0800 (Wed, 05 Dec 2007) Log Message: --- force draw if in interactive mode (so draw() does not need to be explicitly invoked if running in ipython) Modified Paths: -- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py === --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-12-05 19:27:14 UTC (rev 4629) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-12-05 19:28:39 UTC (rev 4630) @@ -16,7 +16,7 @@ date2num: convert from a datetime object to a numeric time value. """ -from matplotlib import rcParams +from matplotlib import rcParams, is_interactive, _pylab_helpers from matplotlib import __version__ as _matplotlib_version # check to make sure matplotlib is not too old. _mpl_required_version = '0.90' @@ -2112,6 +2112,10 @@ if self.noticks: ax.set_xticks([]) ax.set_yticks([]) +# force draw if in interactive mode. +if is_interactive(): +figManager = _pylab_helpers.Gcf.get_active() +figManager.canvas.draw() def scatter(self, *args, **kwargs): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4626] branches/transforms/lib/matplotlib/figure.py
Revision: 4626 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4626&view=rev Author: mdboom Date: 2007-12-05 10:56:42 -0800 (Wed, 05 Dec 2007) Log Message: --- Avoid matching widths and heights too often. Modified Paths: -- branches/transforms/lib/matplotlib/figure.py Modified: branches/transforms/lib/matplotlib/figure.py === --- branches/transforms/lib/matplotlib/figure.py2007-12-05 18:56:18 UTC (rev 4625) +++ branches/transforms/lib/matplotlib/figure.py2007-12-05 18:56:42 UTC (rev 4626) @@ -651,7 +651,7 @@ for size, orig, curr in zip(sizes, orig_pos.size, curr_pos.size): -orig = round(orig * 100.0) / 100.0 +orig = round(orig * 1000.0) / 1000.0 if orig in size: size[orig][0].append(a) size[orig][1].add(curr) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4631] trunk/toolkits/basemap/Changelog
Revision: 4631 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4631&view=rev Author: jswhit Date: 2007-12-05 11:30:21 -0800 (Wed, 05 Dec 2007) Log Message: --- ipython integration. Modified Paths: -- trunk/toolkits/basemap/Changelog Modified: trunk/toolkits/basemap/Changelog === --- trunk/toolkits/basemap/Changelog2007-12-05 19:28:39 UTC (rev 4630) +++ trunk/toolkits/basemap/Changelog2007-12-05 19:30:21 UTC (rev 4631) @@ -1,4 +1,7 @@ version 0.9.9 (not yet released) + * now automatically draws figure if running in +interactive mode (so draw() does not need +to be called explicitly in ipython). * added num2date and date2num functions, which use included netcdftime module. version 0.9.8 (svn revision 4526) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4628] branches/transforms/lib/matplotlib/backends/ backend_agg2.py
Revision: 4628
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4628&view=rev
Author: mdboom
Date: 2007-12-05 10:57:54 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Remove dead code.
Removed Paths:
-
branches/transforms/lib/matplotlib/backends/backend_agg2.py
Deleted: branches/transforms/lib/matplotlib/backends/backend_agg2.py
===
--- branches/transforms/lib/matplotlib/backends/backend_agg2.py 2007-12-05
18:57:06 UTC (rev 4627)
+++ branches/transforms/lib/matplotlib/backends/backend_agg2.py 2007-12-05
18:57:54 UTC (rev 4628)
@@ -1,206 +0,0 @@
-"""
-An agg http://antigrain.com/ backend
-
-"""
-from __future__ import division
-
-import os, sys
-import matplotlib.agg as agg
-
-from matplotlib import verbose
-
-from matplotlib._pylab_helpers import Gcf
-from matplotlib.backend_bases import RendererBase,\
- GraphicsContextBase, FigureManagerBase, FigureCanvasBase
-
-from matplotlib.cbook import enumerate, is_string_like, exception_to_str
-from matplotlib.figure import Figure
-from matplotlib.ft2font import FT2Font
-from matplotlib.mathtext import MathTextParser
-
-
-from _backend_agg import RendererAgg as _RendererAgg
-
-backend_version = 'v2.2'
-_fontd = {} # a map from fname to font instances
-
-
-class RendererAgg(RendererBase):
-"""
-The renderer handles all the drawing primitives using a graphics
-context instance that controls the colors/styles
-"""
-
-debug=1
-def __init__(self, width, height, dpi):
-if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')
-self.dpi = dpi
-self.width = int(width)
-self.height = int(height)
-
-stride = self.width*4
-self.buffer = agg.buffer(self.width, self.height, stride)
-
-self.rbuf = agg.rendering_buffer()
-self.rbuf.attachb(self.buffer)
-
-self.pf = agg.pixel_format(self.rbuf)
-self.rbase = agg.renderer_base(self.pf)
-
-self.rasterizer = agg.rasterizer_scanline_aa()
-self.scanline = agg.scanline_p8()
-self.renderer = agg.renderer_scanline_aa_solid(self.rbase);
-
-
-def draw_lines(self, gc, x, y, trans):
-"""
-x and y are equal length arrays, draw lines connecting each
-point in x, y
-"""
-
-x, y = trans.numerix_x_y(x,y)
-if len(x)<2: return
-path = agg.path_storage()
-path.move_to(x[0],self.height-y[0])
-for i in xrange(1, len(x)):
-path.line_to(x[i],self.height-y[i])
-
-stroke = agg.conv_stroke(path)
-stroke.width(1.0)
-r,g,b = [int(255*val) for val in gc.get_rgb()]
-a = int(255*gc.get_alpha())
-
-color = agg.rgba8(r,g,b,a)
-self.renderer.color( color )
-self.rasterizer.add_path(stroke)
-agg.render_scanlines(self.rasterizer, self.scanline, self.renderer);
-
-def draw_markers(self, gc, path, rgbFace, xt, yt, trans):
-pass
-
-def draw_arc(self, gcEdge, rgbFace, x, y, width, height, angle1, angle2,
rotation):
-pass
-
-def draw_image(self, x, y, im, origin, bbox):
-pass
-
-def draw_line(self, gc, x1, y1, x2, y2):
-pass
-
-def draw_point(self, gc, x, y):
-pass
-
-def draw_polygon(self, gcEdge, rgbFace, points):
-pass
-
-def draw_rectangle(self, gcEdge, rgbFace, x, y, width, height):
-pass
-
-def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
-pass
-
-def flipy(self):
-return True
-
-def get_canvas_width_height(self):
-return 100, 100
-
-def get_text_width_height(self, s, prop, ismath):
-return 1, 1
-
-def new_gc(self):
-return GraphicsContextBase()
-
-
-def points_to_pixels(self, points):
-"""
-convert point measures to pixes using dpi and the pixels per
-inch of the display
-"""
-if __debug__: verbose.report('RendererAgg.points_to_pixels',
'debug-annoying')
-return points*self.dpi.get()/72.0
-
-
-
-
-
-def new_figure_manager(num, *args, **kwargs):
-"""
-Create a new figure manager instance
-"""
-if __debug__: verbose.report('backend_agg.new_figure_manager',
'debug-annoying')
-FigureClass = kwargs.pop('FigureClass', Figure)
-thisFig = FigureClass(*args, **kwargs)
-canvas = FigureCanvasAgg(thisFig)
-manager = FigureManagerBase(canvas, num)
-return manager
-
-
-class FigureCanvasAgg(FigureCanvasBase):
-"""
-The canvas the figure renders into. Calls the draw and print fig
-methods, creates the renderers, etc...
-
-Public attribute
-
- figure - A Figure instance
-"""
-
-
-
-def draw(self):
-"""
-Draw the figure using the renderer
-"""
-if __debug__: verbose.report('FigureCanvasAgg.draw', 'debug-annoying')
-
-renderer = self.get_renderer()
-self.figure.
SF.net SVN: matplotlib: [4621] branches/transforms
Revision: 4621
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4621&view=rev
Author: mdboom
Date: 2007-12-05 08:38:01 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Merged revisions 4619-4620 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4620 | mdboom | 2007-12-05 11:35:26 -0500 (Wed, 05 Dec 2007) | 2 lines
Fix reference leak in draw_text_image.
Modified Paths:
--
branches/transforms/src/_backend_agg.cpp
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4618
+ /trunk/matplotlib:1-4620
Modified: branches/transforms/src/_backend_agg.cpp
===
--- branches/transforms/src/_backend_agg.cpp2007-12-05 16:35:26 UTC (rev
4620)
+++ branches/transforms/src/_backend_agg.cpp2007-12-05 16:38:01 UTC (rev
4621)
@@ -661,8 +661,8 @@
const unsigned char* buffer = NULL;
int width, height;
Py::Object image_obj = args[0];
+ PyArrayObject* image_array = NULL;
if (PyArray_Check(image_obj.ptr())) {
-PyArrayObject* image_array = NULL;
image_array = (PyArrayObject*)PyArray_FromObject(image_obj.ptr(),
PyArray_UBYTE, 2, 2);
if (!image_array)
throw Py::ValueError("First argument to draw_text_image must be a
FT2Font.Image object or a Nx2 uint8 numpy array.");
@@ -685,6 +685,7 @@
}
catch (Py::TypeError) {
//x,y out of range; todo issue warning?
+Py_XDECREF(image_array);
return Py::Object();
}
@@ -727,6 +728,8 @@
theRasterizer->add_path(rect2);
agg::render_scanlines(*theRasterizer, *slineP8, ri);
+ Py_XDECREF(image_array);
+
return Py::Object();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4619] branches/transforms
Revision: 4619
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4619&view=rev
Author: mdboom
Date: 2007-12-05 08:28:05 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Merged revisions 4616-4618 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4618 | mdboom | 2007-12-05 11:20:54 -0500 (Wed, 05 Dec 2007) | 2 lines
Support arbitrary rotation of usetex text.
Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_agg.py
branches/transforms/lib/matplotlib/texmanager.py
branches/transforms/src/_backend_agg.cpp
branches/transforms/src/_image.cpp
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4615
+ /trunk/matplotlib:1-4618
Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-12-05
16:20:54 UTC (rev 4618)
+++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-12-05
16:28:05 UTC (rev 4619)
@@ -71,7 +71,7 @@
self.tostring_rgba_minimized = self._renderer.tostring_rgba_minimized
self.mathtext_parser = MathTextParser('Agg')
self._fontd = {}
-
+
self.bbox = Bbox.from_bounds(0, 0, self.width, self.height)
if __debug__: verbose.report('RendererAgg.__init__ done',
'debug-annoying')
@@ -84,7 +84,7 @@
'debug-annoying')
ox, oy, width, height, descent, font_image, used_characters = \
self.mathtext_parser.parse(s, self.dpi, prop)
-
+
x = int(x) + ox
y = int(y) - oy
self._renderer.draw_text_image(font_image, x, y + 1, angle, gc)
@@ -112,7 +112,7 @@
self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1,
angle, gc)
-def get_text_width_height_descent(self, s, prop, ismath, rgb=(0,0,0)):
+def get_text_width_height_descent(self, s, prop, ismath):
"""
get the width and height in display coords of the string s
with FontPropertry prop
@@ -125,8 +125,8 @@
# todo: handle props
size = prop.get_size_in_points()
texmanager = self.get_texmanager()
-Z = texmanager.get_rgba(s, size, self.dpi, rgb)
-m,n,tmp = Z.shape
+Z = texmanager.get_grey(s, size, self.dpi)
+m,n = Z.shape
# TODO: descent of TeX text (I am imitating backend_ps here -JKS)
return n, m, 0
@@ -145,45 +145,18 @@
def draw_tex(self, gc, x, y, s, prop, angle):
# todo, handle props, angle, origins
-rgb = gc.get_rgb()
size = prop.get_size_in_points()
dpi = self.dpi
-flip = angle==90
-w,h,d = self.get_text_width_height_descent(s, prop, 'TeX', rgb)
-if flip:
-w,h = h,w
-x -= w
-
texmanager = self.get_texmanager()
-key = s, size, dpi, rgb, angle, texmanager.get_font_config()
+key = s, size, dpi, angle, texmanager.get_font_config()
im = self.texd.get(key)
if im is None:
-Z = texmanager.get_rgba(s, size, dpi, rgb)
-if flip:
-r = Z[:,:,0]
-g = Z[:,:,1]
-b = Z[:,:,2]
-a = Z[:,:,3]
-m,n,tmp = Z.shape
+Z = texmanager.get_grey(s, size, dpi)
+Z = npy.array(Z * 255.0, npy.uint8)
-def func(x):
-return npy.transpose(npy.fliplr(x))
+self._renderer.draw_text_image(Z, x, y, angle, gc)
-Z = npy.zeros((n,m,4), float)
-Z[:,:,0] = func(r)
-Z[:,:,1] = func(g)
-Z[:,:,2] = func(b)
-Z[:,:,3] = func(a)
-im = fromarray(Z, 1)
-im.flipud_out()
-self.texd[key] = im
-
-cliprect = gc.get_clip_rectangle()
-if cliprect is None: bbox = None
-else: bbox = Bbox.from_bounds(*cliprect)
-self.draw_image(x, self.height-y, im, bbox)
-
def get_canvas_width_height(self):
'return the canvas width and height in display coords'
return self.width, self.height
@@ -217,7 +190,7 @@
if __debug__: verbose.report('RendererAgg.points_to_pixels',
'debug-annoying')
return points*self.dpi/72.0
-
+
def tostring_rgb(self):
if __debug__: verbose.report('RendererAgg.tostring_rgb',
'debug-annoying')
@@ -314,8 +287,8 @@
FigureCanvasAgg.draw(self)
self.get_renderer()._renderer.write_rgba(str(filename))
print_rgba = pri
SF.net SVN: matplotlib: [4633] trunk/matplotlib/lib/matplotlib
Revision: 4633
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4633&view=rev
Author: mdboom
Date: 2007-12-05 12:28:28 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Fix bug where font files were opened many more times than they need to be.
Modified Paths:
--
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/font_manager.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-12-05
19:36:36 UTC (rev 4632)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-12-05
20:28:28 UTC (rev 4633)
@@ -80,7 +80,8 @@
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import RendererBase,\
GraphicsContextBase, FigureManagerBase, FigureCanvasBase
-from matplotlib.cbook import enumerate, is_string_like, exception_to_str
+from matplotlib.cbook import enumerate, is_string_like, exception_to_str, \
+maxdict
from matplotlib.figure import Figure
from matplotlib.font_manager import findfont
from matplotlib.ft2font import FT2Font, LOAD_FORCE_AUTOHINT
@@ -98,7 +99,8 @@
"""
debug=1
-texd = {} # a cache of tex image rasters
+texd = maxdict(50) # a cache of tex image rasters
+_fontd = maxdict(50)
def __init__(self, width, height, dpi):
if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')
RendererBase.__init__(self)
@@ -125,7 +127,6 @@
self.copy_from_bbox = self._renderer.copy_from_bbox
self.restore_region = self._renderer.restore_region
self.mathtext_parser = MathTextParser('Agg')
-self._fontd = {}
self.bbox = lbwh_to_bbox(0,0, self.width, self.height)
if __debug__: verbose.report('RendererAgg.__init__ done',
@@ -272,7 +273,10 @@
if font is None:
fname = findfont(prop)
-font = FT2Font(str(fname))
+font = self._fontd.get(fname)
+if font is None:
+font = FT2Font(str(fname))
+self._fontd[fname] = font
self._fontd[key] = font
font.clear()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-12-05
19:36:36 UTC (rev 4632)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-12-05
20:28:28 UTC (rev 4633)
@@ -25,7 +25,7 @@
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
FigureManagerBase, FigureCanvasBase
from matplotlib.cbook import Bunch, enumerate, is_string_like, reverse_dict, \
-get_realpath_and_stat, is_writable_file_like
+get_realpath_and_stat, is_writable_file_like, maxdict
from matplotlib.figure import Figure
from matplotlib.font_manager import findfont, is_opentype_cff_font
from matplotlib.afm import AFM
@@ -1147,13 +1147,13 @@
self.write("\nstartxref\n%d\nEOF\n" % self.startxref)
class RendererPdf(RendererBase):
+truetype_font_cache = maxdict(50)
+afm_font_cache = maxdict(50)
def __init__(self, file, dpi):
RendererBase.__init__(self)
self.file = file
self.gc = self.new_gc()
-self.truetype_font_cache = {}
-self.afm_font_cache = {}
self.file.used_characters = self.used_characters = {}
self.mathtext_parser = MathTextParser("Pdf")
self.image_magnification = dpi/72.0
@@ -1161,8 +1161,6 @@
def finalize(self):
self.gc.finalize()
-del self.truetype_font_cache
-del self.afm_font_cache
def check_gc(self, gc, fillcolor=None):
orig_fill = gc._fillcolor
@@ -1679,9 +1677,12 @@
font = self.afm_font_cache.get(key)
if font is None:
filename = findfont(prop, fontext='afm')
-fh = file(filename)
-font = AFM(fh)
-fh.close()
+font = self.afm_font_cache.get(filename)
+if font is None:
+fh = file(filename)
+font = AFM(fh)
+self.afm_font_cache[filename] = font
+fh.close()
self.afm_font_cache[key] = font
return font
@@ -1690,7 +1691,10 @@
font = self.truetype_font_cache.get(key)
if font is None:
filename = findfont(prop)
-font = FT2Font(str(filename))
+font = self.truetype_font_cache.get(filename)
+if font is None:
+font = FT2Font(str(filename))
+self.truetype_font_cache[filename] = font
self.truetype_font_cache[key] = fon
SF.net SVN: matplotlib: [4634] branches/transforms
Revision: 4634
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4634&view=rev
Author: mdboom
Date: 2007-12-05 13:13:46 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Merged revisions 4621-4633 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4622 | jdh2358 | 2007-12-05 12:11:28 -0500 (Wed, 05 Dec 2007) | 2 lines
updated autofmt_xdate to work in more cases. it no longer raises if axes
aren't subplots
r4629 | jdh2358 | 2007-12-05 14:27:14 -0500 (Wed, 05 Dec 2007) | 2 lines
minor rec2excel enhancements
r4632 | pkienzle | 2007-12-05 14:36:36 -0500 (Wed, 05 Dec 2007) | 1 line
docu update: coord reporting works in wx
r4633 | mdboom | 2007-12-05 15:28:28 -0500 (Wed, 05 Dec 2007) | 2 lines
Fix bug where font files were opened many more times than they need to be.
Modified Paths:
--
branches/transforms/examples/coords_report.py
branches/transforms/examples/loadrec.py
branches/transforms/lib/matplotlib/backends/backend_agg.py
branches/transforms/lib/matplotlib/backends/backend_pdf.py
branches/transforms/lib/matplotlib/backends/backend_ps.py
branches/transforms/lib/matplotlib/backends/backend_svg.py
branches/transforms/lib/matplotlib/figure.py
branches/transforms/lib/matplotlib/font_manager.py
branches/transforms/lib/matplotlib/mlab.py
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4620
+ /trunk/matplotlib:1-4633
Modified: branches/transforms/examples/coords_report.py
===
--- branches/transforms/examples/coords_report.py 2007-12-05 20:28:28 UTC
(rev 4633)
+++ branches/transforms/examples/coords_report.py 2007-12-05 21:13:46 UTC
(rev 4634)
@@ -1,7 +1,6 @@
#!/usr/bin/env python
-# override the default reporting of coords (coords reporting not
-# implemented yet on wx*)
+# override the default reporting of coords
from pylab import *
Modified: branches/transforms/examples/loadrec.py
===
--- branches/transforms/examples/loadrec.py 2007-12-05 20:28:28 UTC (rev
4633)
+++ branches/transforms/examples/loadrec.py 2007-12-05 21:13:46 UTC (rev
4634)
@@ -9,4 +9,6 @@
ax = fig.add_subplot(111)
ax.plot(a.date, a.adj_close, '-')
fig.autofmt_xdate()
+
+mlab.rec2excel(a, 'test.xls', colnum=4)
show()
Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-12-05
20:28:28 UTC (rev 4633)
+++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-12-05
21:13:46 UTC (rev 4634)
@@ -31,7 +31,8 @@
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import RendererBase,\
GraphicsContextBase, FigureManagerBase, FigureCanvasBase
-from matplotlib.cbook import enumerate, is_string_like, exception_to_str
+from matplotlib.cbook import enumerate, is_string_like, exception_to_str, \
+maxdict
from matplotlib.figure import Figure
from matplotlib.font_manager import findfont
from matplotlib.ft2font import FT2Font, LOAD_FORCE_AUTOHINT
@@ -49,7 +50,8 @@
context instance that controls the colors/styles
"""
debug=1
-texd = {} # a cache of tex image rasters
+texd = maxdict(50) # a cache of tex image rasters
+_fontd = maxdict(50)
def __init__(self, width, height, dpi):
if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')
RendererBase.__init__(self)
@@ -70,7 +72,6 @@
self.restore_region = self._renderer.restore_region
self.tostring_rgba_minimized = self._renderer.tostring_rgba_minimized
self.mathtext_parser = MathTextParser('Agg')
-self._fontd = {}
self.bbox = Bbox.from_bounds(0, 0, self.width, self.height)
if __debug__: verbose.report('RendererAgg.__init__ done',
@@ -172,7 +173,10 @@
if font is None:
fname = findfont(prop)
-font = FT2Font(str(fname))
+font = self._fontd.get(fname)
+if font is None:
+font = FT2Font(str(fname))
+self._fontd[fname] = font
self._fontd[key] = font
font.clear()
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-05
20:28:28 UTC (rev 4633)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-05
21:13:46 UTC (rev 4634)
@@ -26,7 +26,7 @@
FigureManagerBase, FigureCanvasBase
from matplotlib.backends.backen
SF.net SVN: matplotlib: [4635] trunk/toolkits/basemap/geos-2.2.3/source
Revision: 4635
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4635&view=rev
Author: jswhit
Date: 2007-12-05 15:01:05 -0800 (Wed, 05 Dec 2007)
Log Message:
---
suppress building of tests (may be causing Leopard builds to fail)
Modified Paths:
--
trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in
Added Paths:
---
trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in.orig
Modified: trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in
===
--- trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in2007-12-05
21:13:46 UTC (rev 4634)
+++ trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in2007-12-05
23:01:05 UTC (rev 4635)
@@ -168,9 +168,7 @@
SUBDIRS = \
geom \
headers \
- bigtest \
- capi \
- test
+ capi
EXTRA_DIST = Makefile.vc
all: all-recursive
Added: trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in.orig
===
--- trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in.orig
(rev 0)
+++ trunk/toolkits/basemap/geos-2.2.3/source/Makefile.in.orig 2007-12-05
23:01:05 UTC (rev 4635)
@@ -0,0 +1,474 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
[EMAIL PROTECTED]@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = source
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/source/headers/config.h \
+ $(top_builddir)/source/headers/geos/platform.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_
SF.net SVN: matplotlib: [4625] branches/transforms/lib/matplotlib
Revision: 4625 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4625&view=rev Author: mdboom Date: 2007-12-05 10:56:18 -0800 (Wed, 05 Dec 2007) Log Message: --- Make things more robust to changes in dpi. Modified Paths: -- branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/backends/backend_cairo.py branches/transforms/lib/matplotlib/text.py Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-12-05 18:14:38 UTC (rev 4624) +++ branches/transforms/lib/matplotlib/axis.py 2007-12-05 18:56:18 UTC (rev 4625) @@ -86,8 +86,6 @@ self._loc = loc self._size = size -self._padPixels = self.figure.dpi * self._pad * (1/72.0) - self.tick1line = self._get_tick1line() self.tick2line = self._get_tick2line() self.gridline = self._get_gridline() @@ -115,6 +113,9 @@ self.gridline.set_clip_path(clippath, transform) set_clip_path.__doc__ = Artist.set_clip_path.__doc__ +def get_pad_pixels(self): +return self.figure.dpi * self._pad / 72.0 + def contains(self, mouseevent): """Test whether the mouse event occured in the Tick marks. @@ -222,7 +223,7 @@ # get the affine as an a,b,c,d,tx,ty list # x in data coords, y in axes coords #t = Text( -trans, vert, horiz = self.axes.get_xaxis_text1_transform(self._padPixels) +trans, vert, horiz = self.axes.get_xaxis_text1_transform(self.get_pad_pixels()) t = TextWithDash( x=0, y=0, @@ -244,7 +245,7 @@ 'Get the default Text 2 instance' # x in data coords, y in axes coords #t = Text( -trans, vert, horiz = self.axes.get_xaxis_text2_transform(self._padPixels) +trans, vert, horiz = self.axes.get_xaxis_text2_transform(self.get_pad_pixels()) t = TextWithDash( x=0, y=1, @@ -341,7 +342,7 @@ 'Get the default Text instance' # x in axes coords, y in data coords #t = Text( -trans, vert, horiz = self.axes.get_yaxis_text1_transform(self._padPixels) +trans, vert, horiz = self.axes.get_yaxis_text1_transform(self.get_pad_pixels()) t = TextWithDash( x=0, y=0, @@ -361,7 +362,7 @@ 'Get the default Text instance' # x in axes coords, y in data coords #t = Text( -trans, vert, horiz = self.axes.get_yaxis_text2_transform(self._padPixels) +trans, vert, horiz = self.axes.get_yaxis_text2_transform(self.get_pad_pixels()) t = TextWithDash( x=1, y=0, @@ -1173,7 +1174,7 @@ """ bbox, bbox2 = self.get_ticklabel_extents(renderer) # MGDTODO: Need a better way to get the pad -padPixels = self.majorTicks[0]._padPixels +padPixels = self.majorTicks[0].get_pad_pixels() above = 0.0 if bbox2.height: @@ -1409,7 +1410,7 @@ def get_text_widths(self, renderer): bbox, bbox2 = self.get_ticklabel_extents(renderer) # MGDTODO: Need a better way to get the pad -padPixels = self.majorTicks[0]._padPixels +padPixels = self.majorTicks[0].get_pad_pixels() left = 0.0 if bbox.width: Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py === --- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-12-05 18:14:38 UTC (rev 4624) +++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-12-05 18:56:18 UTC (rev 4625) @@ -146,10 +146,9 @@ def draw_tex(self, gc, x, y, s, prop, angle): # todo, handle props, angle, origins size = prop.get_size_in_points() -dpi = self.dpi texmanager = self.get_texmanager() -key = s, size, dpi, angle, texmanager.get_font_config() +key = s, size, self.dpi, angle, texmanager.get_font_config() im = self.texd.get(key) if im is None: Z = texmanager.get_grey(s, size, dpi) @@ -285,10 +284,16 @@ def print_raw(self, filename, *args, **kwargs): FigureCanvasAgg.draw(self) -self.get_renderer()._renderer.write_rgba(str(filename)) +original_dpi = renderer.dpi +renderer.dpi = self.figure.dpi +renderer._renderer.write_rgba(str(filename)) +renderer.dpi = original_dpi print_rgba = print_raw def print_png(self, filename, *args, **kwargs): FigureCanvasAgg.draw(self) -self.get_renderer()._renderer.write_png(filename, self.figure.dpi) - +renderer = self.get_renderer() +original_dpi = renderer.dpi +renderer.dpi = self.figure.dpi +renderer._renderer.write_png(filename, self.figure.dpi) +
SF.net SVN: matplotlib: [4616] branches/transforms
Revision: 4616 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4616&view=rev Author: mdboom Date: 2007-12-05 07:39:39 -0800 (Wed, 05 Dec 2007) Log Message: --- Merged revisions 4562-4615 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r4571 | jdh2358 | 2007-12-03 21:06:52 -0500 (Mon, 03 Dec 2007) | 1 line applied barrys cocoaagg patch r4572 | jdh2358 | 2007-12-03 22:18:39 -0500 (Mon, 03 Dec 2007) | 1 line colormapped histogram r4576 | jdh2358 | 2007-12-04 09:38:48 -0500 (Tue, 04 Dec 2007) | 2 lines added additional lines to MANIFEST.in r4586 | mdboom | 2007-12-04 14:34:11 -0500 (Tue, 04 Dec 2007) | 2 lines Support '|' as a symbol in mathtext. r4606 | jdh2358 | 2007-12-04 21:47:07 -0500 (Tue, 04 Dec 2007) | 1 line updated install doc r4613 | dsdale | 2007-12-05 09:45:56 -0500 (Wed, 05 Dec 2007) | 2 lines removed .cvsignore files, they are not needed r4614 | jdh2358 | 2007-12-05 10:16:48 -0500 (Wed, 05 Dec 2007) | 2 lines exposed default color cycle Modified Paths: -- branches/transforms/API_CHANGES branches/transforms/CODING_GUIDE branches/transforms/INSTALL branches/transforms/MANIFEST.in branches/transforms/examples/poly_editor.py branches/transforms/lib/matplotlib/__init__.py branches/transforms/lib/matplotlib/_mathtext_data.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backends/backend_cocoaagg.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/mathtext.py branches/transforms/matplotlibrc.template Added Paths: --- branches/transforms/examples/hist_colormapped.py Removed Paths: - branches/transforms/.cvsignore branches/transforms/examples/.cvsignore branches/transforms/lib/matplotlib/.cvsignore branches/transforms/lib/matplotlib/backends/.cvsignore branches/transforms/lib/matplotlib/numerix/.cvsignore branches/transforms/lib/matplotlib/numerix/mlab/.cvsignore Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-4561 + /trunk/matplotlib:1-4615 Deleted: branches/transforms/.cvsignore === --- branches/transforms/.cvsignore 2007-12-05 15:36:48 UTC (rev 4615) +++ branches/transforms/.cvsignore 2007-12-05 15:39:39 UTC (rev 4616) @@ -1,6 +0,0 @@ -build -dist -docs -*.pyc -.project -matplotlibrc Modified: branches/transforms/API_CHANGES === --- branches/transforms/API_CHANGES 2007-12-05 15:36:48 UTC (rev 4615) +++ branches/transforms/API_CHANGES 2007-12-05 15:39:39 UTC (rev 4616) @@ -169,6 +169,8 @@ END OF TRANSFORMS REFACTORING +Removed, dead/experimental ExampleInfo, Namespace and Importer +code from matplotlib/__init__.py 0.91.1 Released 0.91.0 Released Modified: branches/transforms/CODING_GUIDE === --- branches/transforms/CODING_GUIDE2007-12-05 15:36:48 UTC (rev 4615) +++ branches/transforms/CODING_GUIDE2007-12-05 15:39:39 UTC (rev 4616) @@ -39,8 +39,11 @@ * If you have altered extension code, do you pass unit/memleak_hawaii.py? + * if you have added new files or directories, or reorganized +existing ones, are the new files included in the match patterns in +MANIFEST.in. This file determines what goes into the src +distribution of the mpl build. - == Importing and name spaces == For numpy, use: Modified: branches/transforms/INSTALL === --- branches/transforms/INSTALL 2007-12-05 15:36:48 UTC (rev 4615) +++ branches/transforms/INSTALL 2007-12-05 15:39:39 UTC (rev 4616) @@ -1,42 +1,42 @@ + INTRODUCTION - matplotlib requires at a minimum python 2.2+, Numeric or numarray - and freetype. To get the most out of matplotlib, you will want to - build some of the optional GUI and image extensions, discussed - below. Matplotlib is known to work on linux, unix, win32 and OS X + matplotlib requires at a minimum python 2.3, numpy, libpng and + freetype. To get the most out of matplotlib, you will want to build + some of the optional GUI and image extensions, discussed below. + Matplotlib is known to work on linux, unix, win32 and OS X platforms. There are two kinds of matplotlib backends: vector based and raster - based. The vector based backends, SVG and PS, produce ASCII text - output files *.svg and *.ps. The core raster based renderer is the - http://antigrain.com (agg) backend. This is a high quality 2D - library that supports fast a
SF.net SVN: matplotlib: [4618] trunk/matplotlib
Revision: 4618
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4618&view=rev
Author: mdboom
Date: 2007-12-05 08:20:54 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Support arbitrary rotation of usetex text.
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/lib/matplotlib/texmanager.py
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_image.cpp
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-12-05
15:40:46 UTC (rev 4617)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-12-05
16:20:54 UTC (rev 4618)
@@ -27,8 +27,8 @@
REQUIREMENTs
python2.3+
-numpy 1.0 +
-
+numpy 1.0 +
+
agg2 (see below)
freetype 2
libpng
@@ -126,7 +126,7 @@
self.restore_region = self._renderer.restore_region
self.mathtext_parser = MathTextParser('Agg')
self._fontd = {}
-
+
self.bbox = lbwh_to_bbox(0,0, self.width, self.height)
if __debug__: verbose.report('RendererAgg.__init__ done',
'debug-annoying')
@@ -175,7 +175,7 @@
'debug-annoying')
ox, oy, width, height, descent, font_image, used_characters = \
self.mathtext_parser.parse(s, self.dpi.get(), prop)
-
+
x = int(x) + ox
y = int(y) - oy
self._renderer.draw_text_image(font_image, x, y + 1, angle, gc)
@@ -209,7 +209,7 @@
self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1,
angle, gc)
-def get_text_width_height_descent(self, s, prop, ismath, rgb=(0,0,0)):
+def get_text_width_height_descent(self, s, prop, ismath):
"""
get the width and height in display coords of the string s
with FontPropertry prop
@@ -222,8 +222,8 @@
# todo: handle props
size = prop.get_size_in_points()
texmanager = self.get_texmanager()
-Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb)
-m,n,tmp = Z.shape
+Z = texmanager.get_grey(s, size, self.dpi.get())
+m,n = Z.shape
# TODO: descent of TeX text (I am imitating backend_ps here -JKS)
return n, m, 0
@@ -242,45 +242,19 @@
def draw_tex(self, gc, x, y, s, prop, angle):
# todo, handle props, angle, origins
-rgb = gc.get_rgb()
size = prop.get_size_in_points()
dpi = self.dpi.get()
-flip = angle==90
-w,h,d = self.get_text_width_height_descent(s, prop, 'TeX', rgb)
-if flip:
-w,h = h,w
-x -= w
-
texmanager = self.get_texmanager()
-key = s, size, dpi, rgb, angle, texmanager.get_font_config()
+key = s, size, dpi, angle, texmanager.get_font_config()
im = self.texd.get(key)
if im is None:
-Z = texmanager.get_rgba(s, size, dpi, rgb)
-if flip:
-r = Z[:,:,0]
-g = Z[:,:,1]
-b = Z[:,:,2]
-a = Z[:,:,3]
-m,n,tmp = Z.shape
+Z = texmanager.get_grey(s, size, dpi)
+Z = npy.array(Z * 255.0, npy.uint8)
-def func(x):
-return npy.transpose(npy.fliplr(x))
+self._renderer.draw_text_image(Z, x, y, angle, gc)
-Z = npy.zeros((n,m,4), float)
-Z[:,:,0] = func(r)
-Z[:,:,1] = func(g)
-Z[:,:,2] = func(b)
-Z[:,:,3] = func(a)
-im = fromarray(Z, 1)
-im.flipud_out()
-self.texd[key] = im
-cliprect = gc.get_clip_rectangle()
-if cliprect is None: bbox = None
-else: bbox = lbwh_to_bbox(*cliprect)
-self.draw_image(x, self.height-y, im, bbox)
-
def get_canvas_width_height(self):
'return the canvas width and height in display coords'
return self.width, self.height
@@ -413,8 +387,8 @@
self.draw()
self.get_renderer()._renderer.write_rgba(str(filename))
print_rgba = print_raw
-
+
def print_png(self, filename, *args, **kwargs):
self.draw()
self.get_renderer()._renderer.write_png(filename,
self.figure.dpi.get())
-
+
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===
--- trunk/matplotlib/lib/matplotlib/texmanager.py 2007-12-05 15:40:46 UTC
(rev 4617)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py 2007-12-05 16:20:54 UTC
(rev 4618)
@@ -79,7 +79,8 @@
dvipngVersion = get_dvipng_version()
# mappable cache of
-arrayd = {}
+rgba_arrayd = {}
+grey_arrayd = {}
postscriptd = {}
pscnt = 0
@@ -131,7
SF.net SVN: matplotlib: [4611] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py
Revision: 4611 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4611&view=rev Author: jswhit Date: 2007-12-05 05:11:58 -0800 (Wed, 05 Dec 2007) Log Message: --- docstring tweaks Modified Paths: -- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py === --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-12-05 13:00:41 UTC (rev 4610) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-12-05 13:11:58 UTC (rev 4611) @@ -2866,13 +2866,13 @@ """ Return datetime objects given numeric time values. The units of the numeric time values are described by the units argument -and the calendar keyword. The datetime objects represent +and the calendar keyword. The returned datetime objects represent UTC with no time-zone offset, even if the specified units contain a time-zone offset. Like the matplotlib num2date function, except that it allows for different units and calendars. Behaves the same if -units = 'days since 0001-01-01 00:00:00' and +units = 'days since 001-01-01 00:00:00' and calendar = 'proleptic_gregorian'. Arguments: @@ -2882,7 +2882,7 @@ units - a string of the form ' since ' describing the time units. can be days, hours, minutes or seconds. is the time origin. A valid choice - would be units='hours since 0001-01-01 00:00:00'. + would be units='hours since 1800-01-01 00:00:00 -6:00'. calendar - describes the calendar used in the time calculations. All the values currently defined in the CF metadata convention @@ -2900,7 +2900,9 @@ objects which support some but not all the methods of 'real' python datetime objects. This is because the python datetime module cannot the weird dates in some calendars (such as '360_day' and 'all_leap' -which don't exist in any real world calendar. +which don't exist in any real world calendar. The datetime instances +do not contain a time-zone offset, even if the specified units +contains one. """ cdftime = netcdftime.utime(units,calendar=calendar) return cdftime.num2date(times) @@ -2922,11 +2924,12 @@ Arguments: dates - A datetime object or a sequence of datetime objects. + The datetime objects should not include a time-zone offset. units - a string of the form ' since ' describing the time units. can be days, hours, minutes or seconds. is the time origin. A valid choice - would be units='hours since 0001-01-01 00:00:00'. + would be units='hours since 1800-01-01 00:00:00 -6:00'. calendar - describes the calendar used in the time calculations. All the values currently defined in the CF metadata convention This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4620] trunk/matplotlib/src/_backend_agg.cpp
Revision: 4620
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4620&view=rev
Author: mdboom
Date: 2007-12-05 08:35:26 -0800 (Wed, 05 Dec 2007)
Log Message:
---
Fix reference leak in draw_text_image.
Modified Paths:
--
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===
--- trunk/matplotlib/src/_backend_agg.cpp 2007-12-05 16:28:05 UTC (rev
4619)
+++ trunk/matplotlib/src/_backend_agg.cpp 2007-12-05 16:35:26 UTC (rev
4620)
@@ -2140,8 +2140,8 @@
const unsigned char* buffer = NULL;
int width, height;
Py::Object image_obj = args[0];
+ PyArrayObject* image_array = NULL;
if (PyArray_Check(image_obj.ptr())) {
-PyArrayObject* image_array = NULL;
image_array = (PyArrayObject*)PyArray_FromObject(image_obj.ptr(),
PyArray_UBYTE, 2, 2);
if (!image_array)
throw Py::ValueError("First argument to draw_text_image must be a
FT2Font.Image object or a Nx2 uint8 numpy array.");
@@ -2164,6 +2164,8 @@
}
catch (Py::TypeError) {
//x,y out of range; todo issue warning?
+if (image_array)
+ Py_XDECREF(image_array);
return Py::Object();
}
@@ -2209,6 +2211,8 @@
theRasterizer->add_path(rect2);
agg::render_scanlines(*theRasterizer, *slineP8, ri);
+ if (image_array)
+Py_XDECREF(image_array);
return Py::Object();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4610] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap
Revision: 4610
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4610&view=rev
Author: jswhit
Date: 2007-12-05 05:00:41 -0800 (Wed, 05 Dec 2007)
Log Message:
---
include time-zone offset in num2date and date2num.
Modified Paths:
--
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py
2007-12-05 08:53:31 UTC (rev 4609)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py
2007-12-05 13:00:41 UTC (rev 4610)
@@ -2866,7 +2866,9 @@
"""
Return datetime objects given numeric time values. The units
of the numeric time values are described by the units argument
-and the calendar keyword. The time zone is assumed to be UTC.
+and the calendar keyword. The datetime objects represent
+UTC with no time-zone offset, even if the specified
+units contain a time-zone offset.
Like the matplotlib num2date function, except that it allows
for different units and calendars. Behaves the same if
@@ -2907,7 +2909,10 @@
"""
Return numeric time values given datetime objects. The units
of the numeric time values are described by the units argument
-and the calendar keyword. The time zone is assumed to UTC.
+and the calendar keyword. The datetime objects must
+be in UTC with no time-zone offset. If there is a
+time-zone offset in units, it will be applied to the
+returned numeric values.
Like the matplotlib date2num function, except that it allows
for different units and calendars. Behaves the same if
Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
2007-12-05 08:53:31 UTC (rev 4609)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/netcdftime.py
2007-12-05 13:00:41 UTC (rev 4610)
@@ -446,9 +446,7 @@
# parse the date string.
n = timestr.find('since')+6
year,month,day,hour,minute,second,utc_offset = _parse_date(timestr[n:])
-if utc_offset:
-raise ValueError("time zone offset not allowed")
-return units, datetime(year, month, day, hour, minute, second)
+return units, utc_offset, datetime(year, month, day, hour, minute, second)
class utime:
"""
@@ -589,7 +587,8 @@
self.calendar = calendar
else:
raise ValueError, "calendar must be one of %s, got '%s'" %
(str(_calendars),calendar)
-units, self.origin = _dateparse(unit_string)
+units, tzoffset, self.origin = _dateparse(unit_string)
+self.tzoffset = tzoffset # time zone offset in minutes
self.units = units
self.unit_string = unit_string
if self.calendar in ['noleap','365_day'] and self.origin.month == 2
and self.origin.day == 29:
@@ -610,6 +609,10 @@
Returns C{time_value} in units described by L{unit_string}, using
the specified L{calendar}, given a 'datetime-like' object.
+The datetime object must represent UTC with no time-zone offset.
+If there is a time-zone offset implied by L{unit_string}, it will
+be applied to the returned numeric values.
+
Resolution is 1 second.
If C{calendar = 'standard'} or C{'gregorian'} (indicating
@@ -654,12 +657,15 @@
jdelta = [_360DayFromDate(d)-self._jd0 for d in date.flat]
if not isscalar:
jdelta = numpy.array(jdelta)
+# convert to desired units, add time zone offset.
if self.units in ['second','seconds']:
-jdelta = jdelta*86400.
+jdelta = jdelta*86400. + self.tzoffset*60.
elif self.units in ['minute','minutes']:
-jdelta = jdelta*1440.
-elif self.units in ['hours','hours']:
-jdelta = jdelta*24.
+jdelta = jdelta*1440. + self.tzoffset
+elif self.units in ['hour','hours']:
+jdelta = jdelta*24. + self.tzoffset/60.
+elif self.units in ['day','days']:
+jdelta = jdelta + self.tzoffset/1440.
if isscalar:
return jdelta
else:
@@ -670,6 +676,9 @@
Return a 'datetime-like' object given a C{time_value} in units
described by L{unit_string}, using L{calendar}.
+dates are in UTC with no offset, even if L{unit_string} contains
+a time zone offset from UTC.
+
Resolution is 1 second.
Works for scalars, sequences and numpy arrays.
@@ -692,14 +701,15 @@
if not isscalar:
time_value = numpy.array(time_value)
shape = time_value.shape
+# convert to desired units, remove time zone offset.
if self.units in ['second','seconds']:
-
SF.net SVN: matplotlib: [4637] trunk/matplotlib/lib/matplotlib/text.py
Revision: 4637 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4637&view=rev Author: jrevans Date: 2007-12-05 16:09:49 -0800 (Wed, 05 Dec 2007) Log Message: --- Submitted the wrong version. This is the correct one. Modified Paths: -- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py === --- trunk/matplotlib/lib/matplotlib/text.py 2007-12-06 00:04:49 UTC (rev 4636) +++ trunk/matplotlib/lib/matplotlib/text.py 2007-12-06 00:09:49 UTC (rev 4637) @@ -1025,6 +1025,7 @@ 'axes pixels' : pixels from lower left corner of axes 'axes fraction' : 0,1 is lower left of axes and 1,1 is upper right 'data': use the coordinate system of the object being annotated (default) + 'data offset' : Specify an offset (in points) from the xy value 'polar' : you can specify theta, r for the annotation, even in cartesian plots. Note that if you are using a polar axes, you do not need @@ -1083,11 +1084,13 @@ elif s=='data offset': # convert the data point dx, dy = self.xy -trans = self.axes.transData -dx = float(self.convert_xunits(dx)) -dy = float(self.convert_yunits(dy)) -dx, dy = trans.xy_tup((dx, dy)) +# prevent recursion +if self.xycoords == 'data offset': + return self._get_xy(dx, dy, 'data') + +dx, dy = self._get_xy(dx, dy, self.xycoords) + # convert the offset dpi = self.figure.dpi.get() x *= dpi/72. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4636] trunk/matplotlib/lib/matplotlib/text.py
Revision: 4636 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4636&view=rev Author: jrevans Date: 2007-12-05 16:04:49 -0800 (Wed, 05 Dec 2007) Log Message: --- Added a 'data offset' coordinate to the Annotation class. Modified Paths: -- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py === --- trunk/matplotlib/lib/matplotlib/text.py 2007-12-05 23:01:05 UTC (rev 4635) +++ trunk/matplotlib/lib/matplotlib/text.py 2007-12-06 00:04:49 UTC (rev 4636) @@ -1080,6 +1080,24 @@ x = float(self.convert_xunits(x)) y = float(self.convert_yunits(y)) return trans.xy_tup((x,y)) +elif s=='data offset': +# convert the data point +dx, dy = self.xy +trans = self.axes.transData +dx = float(self.convert_xunits(dx)) +dy = float(self.convert_yunits(dy)) +dx, dy = trans.xy_tup((dx, dy)) + +# convert the offset +dpi = self.figure.dpi.get() +x *= dpi/72. +y *= dpi/72. + +# add the offset to the data point +x += dx +y += dy + +return x, y elif s=='polar': theta, r = x, y x = r*npy.cos(theta) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4638] trunk/matplotlib
Revision: 4638
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4638&view=rev
Author: jdh2358
Date: 2007-12-05 18:36:05 -0800 (Wed, 05 Dec 2007)
Log Message:
---
changed offset naming for annotations
Modified Paths:
--
trunk/matplotlib/examples/annotation_demo.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/examples/annotation_demo.py
===
--- trunk/matplotlib/examples/annotation_demo.py2007-12-06 00:09:49 UTC
(rev 4637)
+++ trunk/matplotlib/examples/annotation_demo.py2007-12-06 02:36:05 UTC
(rev 4638)
@@ -10,6 +10,7 @@
'axes points' : points from lower left corner of axes
'axes pixels' : pixels from lower left corner of axes
'axes fraction' : 0,1 is lower left of axes and 1,1 is upper right
+ 'offset points' : Specify an offset (in points) from the xy value
'data': use the axes data coordinate system
Optionally, you can specify arrow properties which draws and arrow
Modified: trunk/matplotlib/lib/matplotlib/text.py
===
--- trunk/matplotlib/lib/matplotlib/text.py 2007-12-06 00:09:49 UTC (rev
4637)
+++ trunk/matplotlib/lib/matplotlib/text.py 2007-12-06 02:36:05 UTC (rev
4638)
@@ -187,7 +187,7 @@
xmin, ymin = thisx, thisy
lines = self._text.split('\n')
-
+
whs = []
# Find full vertical extent of font,
# including ascenders and descenders:
@@ -1025,7 +1025,7 @@
'axes pixels' : pixels from lower left corner of axes
'axes fraction' : 0,1 is lower left of axes and 1,1 is upper right
'data': use the coordinate system of the object being
annotated (default)
- 'data offset' : Specify an offset (in points) from the xy value
+ 'offset points' : Specify an offset (in points) from the xy
value
'polar' : you can specify theta, r for the annotation,
even
in cartesian plots. Note that if you
are using a polar axes, you do not need
@@ -1081,12 +1081,12 @@
x = float(self.convert_xunits(x))
y = float(self.convert_yunits(y))
return trans.xy_tup((x,y))
-elif s=='data offset':
+elif s=='offset points':
# convert the data point
dx, dy = self.xy
# prevent recursion
-if self.xycoords == 'data offset':
+if self.xycoords == 'offset points':
return self._get_xy(dx, dy, 'data')
dx, dy = self._get_xy(dx, dy, self.xycoords)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
