SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
2
3
4
(1)
5
(6)
6
(1)
7
(5)
8
(4)
9
(7)
10
(2)
11
(12)
12
(2)
13
(1)
14
(4)
15
16
17
(7)
18
(2)
19
(3)
20
(8)
21
(6)
22
23
(9)
24
(4)
25
(9)
26
(2)
27
28
29
(2)
30
(1)






Showing 6 results of 6

From: <ry...@us...> - 2008年11月05日 17:12:09
Revision: 6367
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6367&view=rev
Author: ryanmay
Date: 2008年11月05日 17:12:03 +0000 (2008年11月05日)
Log Message:
-----------
Revert the DraggableRectangle exercise solution to use the Rectangle.xy attribute now that it exists. This agrees with the exercise description.
Modified Paths:
--------------
 trunk/matplotlib/doc/users/event_handling.rst
Modified: trunk/matplotlib/doc/users/event_handling.rst
===================================================================
--- trunk/matplotlib/doc/users/event_handling.rst	2008年11月05日 17:09:55 UTC (rev 6366)
+++ trunk/matplotlib/doc/users/event_handling.rst	2008年11月05日 17:12:03 UTC (rev 6367)
@@ -182,8 +182,8 @@
 
 contains, attrd = self.rect.contains(event)
 if not contains: return
- x0, y0 = self.rect.get_x(), self.rect.get_y()
- print 'event contains', x0, y0
+ print 'event contains', self.rect.xy
+ x0, y0 = self.rect.xy
 self.press = x0, y0, event.xdata, event.ydata
 
 def on_motion(self, event):
@@ -257,8 +257,8 @@
 if DraggableRectangle.lock is not None: return
 contains, attrd = self.rect.contains(event)
 if not contains: return
- x0, y0 = self.rect.get_x(), self.rect.get_y()
- print 'event contains', x0, y0
+ print 'event contains', self.rect.xy
+ x0, y0 = self.rect.xy
 self.press = x0, y0, event.xdata, event.ydata
 DraggableRectangle.lock = self
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2008年11月05日 17:10:02
Revision: 6366
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6366&view=rev
Author: ryanmay
Date: 2008年11月05日 17:09:55 +0000 (2008年11月05日)
Log Message:
-----------
Re-add the xy attribute to the Rectangle class (disappeared during the transforms refactor).
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年11月05日 15:15:28 UTC (rev 6365)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年11月05日 17:09:55 UTC (rev 6366)
@@ -478,6 +478,10 @@
 "Return the bottom coord of the rectangle"
 return self._y
 
+ def get_xy(self):
+ "Return the left and bottom coords of the rectangle"
+ return self._x, self._y
+
 def get_width(self):
 "Return the width of the rectangle"
 return self._width
@@ -502,6 +506,14 @@
 """
 self._y = y
 
+ def set_xy(self, xy):
+ """
+ Set the left and bottom coords of the rectangle
+
+ ACCEPTS: 2-item sequence
+ """
+ self._x, self._y = xy
+
 def set_width(self, w):
 """
 Set the width rectangle
@@ -536,6 +548,8 @@
 def get_bbox(self):
 return transforms.Bbox.from_bounds(self._x, self._y, self._width, self._height)
 
+ xy = property(get_xy, set_xy)
+
 class RegularPolygon(Patch):
 """
 A regular polygon patch.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年11月05日 15:15:37
Revision: 6365
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6365&view=rev
Author: mdboom
Date: 2008年11月05日 15:15:28 +0000 (2008年11月05日)
Log Message:
-----------
Fix bug in zoom rectangle with twin axes
Modified Paths:
--------------
 branches/v0_91_maint/CHANGELOG
 branches/v0_91_maint/lib/matplotlib/backend_bases.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG	2008年11月05日 15:15:10 UTC (rev 6364)
+++ branches/v0_91_maint/CHANGELOG	2008年11月05日 15:15:28 UTC (rev 6365)
@@ -1,3 +1,5 @@
+2008年11月05日 Fix bug with zoom to rectangle and twin axes - MGD
+
 2008年10月05日 Fix problem with AFM files that don't specify the font's
 full name or family name. - JKS
 
Modified: branches/v0_91_maint/lib/matplotlib/backend_bases.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backend_bases.py	2008年11月05日 15:15:10 UTC (rev 6364)
+++ branches/v0_91_maint/lib/matplotlib/backend_bases.py	2008年11月05日 15:15:28 UTC (rev 6365)
@@ -903,7 +903,7 @@
 # can't delete the artist
 while h:
 print "Removing",h
- if h.remove(): 
+ if h.remove():
 self.draw_idle()
 break
 parent = None
@@ -912,7 +912,7 @@
 parent = p
 break
 h = parent
- 
+
 def onHilite(self, ev):
 """
 Mouse event processor which highlights the artists
@@ -1087,7 +1087,7 @@
 # a) otherwise we'd have cyclical imports, since all of these
 # classes inherit from FigureCanvasBase
 # b) so we don't import a bunch of stuff the user may never use
- 
+
 def print_emf(self, *args, **kwargs):
 from backends.backend_emf import FigureCanvasEMF # lazy import
 emf = self.switch_backends(FigureCanvasEMF)
@@ -1097,7 +1097,7 @@
 from backends.backend_ps import FigureCanvasPS # lazy import
 ps = self.switch_backends(FigureCanvasPS)
 return ps.print_eps(*args, **kwargs)
- 
+
 def print_pdf(self, *args, **kwargs):
 from backends.backend_pdf import FigureCanvasPdf # lazy import
 pdf = self.switch_backends(FigureCanvasPdf)
@@ -1107,7 +1107,7 @@
 from backends.backend_agg import FigureCanvasAgg # lazy import
 agg = self.switch_backends(FigureCanvasAgg)
 return agg.print_png(*args, **kwargs)
- 
+
 def print_ps(self, *args, **kwargs):
 from backends.backend_ps import FigureCanvasPS # lazy import
 ps = self.switch_backends(FigureCanvasPS)
@@ -1123,12 +1123,12 @@
 from backends.backend_svg import FigureCanvasSVG # lazy import
 svg = self.switch_backends(FigureCanvasSVG)
 return svg.print_svg(*args, **kwargs)
- 
+
 def print_svgz(self, *args, **kwargs):
 from backends.backend_svg import FigureCanvasSVG # lazy import
 svg = self.switch_backends(FigureCanvasSVG)
 return svg.print_svgz(*args, **kwargs)
- 
+
 def get_supported_filetypes(self):
 return self.filetypes
 
@@ -1138,7 +1138,7 @@
 groupings.setdefault(name, []).append(ext)
 groupings[name].sort()
 return groupings
- 
+
 def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
 orientation='portrait', format=None, **kwargs):
 """
@@ -1176,7 +1176,7 @@
 
 if dpi is None:
 dpi = rcParams['savefig.dpi']
- 
+
 origDPI = self.figure.dpi.get()
 origfacecolor = self.figure.get_facecolor()
 origedgecolor = self.figure.get_edgecolor()
@@ -1199,12 +1199,12 @@
 self.figure.set_edgecolor(origedgecolor)
 self.figure.set_canvas(self)
 self.figure.canvas.draw()
- 
+
 return result
 
 def get_default_filetype(self):
 raise NotImplementedError
- 
+
 def set_window_title(self, title):
 """
 Set the title text of the window containing the figure. Note that
@@ -1696,6 +1696,8 @@
 for cur_xypress in self._xypress:
 x, y = event.x, event.y
 lastx, lasty, a, ind, lim, trans = cur_xypress
+ if a._sharex or a._sharey:
+ continue
 # ignore singular clicks - 5 pixels is a threshold
 if abs(x-lastx)<5 or abs(y-lasty)<5:
 self._xypress = None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年11月05日 15:15:17
Revision: 6364
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6364&view=rev
Author: mdboom
Date: 2008年11月05日 15:15:10 +0000 (2008年11月05日)
Log Message:
-----------
Minor docstring fix.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2008年11月05日 14:43:29 UTC (rev 6363)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2008年11月05日 15:15:10 UTC (rev 6364)
@@ -6931,23 +6931,23 @@
 
 class SubplotBase:
 """
- Base class for subplots, which are Axes instances with additional
- methods to facilitate generating and manipulating a set of Axes
- within a figure.
+ Base class for subplots, which are :class:`Axes` instances with
+ additional methods to facilitate generating and manipulating a set
+ of :class:`Axes` within a figure.
 """
 
 def __init__(self, fig, *args, **kwargs):
 """
- fig is a figure instance
+ *fig* is a :class:`matplotlib.figure.Figure` instance.
 
- args is numRows, numCols, plotNum
- where the array of subplots in the figure has dimensions
- numRows, numCols, and where plotNum is the number of the
- subplot being created. plotNum starts at 1 in the upper
- right corner and increases to the right.
+ *args* is the tuple (*numRows*, *numCols*, *plotNum*), where
+ the array of subplots in the figure has dimensions *numRows*,
+ *numCols*, and where *plotNum* is the number of the subplot
+ being created. *plotNum* starts at 1 in the upper right
+ corner and increases to the right.
 
- If numRows<=numCols<=plotNum<10, args can be the decimal
- integer numRows*100 + numCols*10 + plotNum.
+ If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
+ decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
 """
 
 self.figure = fig
@@ -6982,7 +6982,7 @@
 
 # COVERAGE NOTE: Never used internally or from examples
 def change_geometry(self, numrows, numcols, num):
- 'change subplot geometry, eg from 1,1,1 to 2,2,3'
+ 'change subplot geometry, eg. from 1,1,1 to 2,2,3'
 self._rows = numrows
 self._cols = numcols
 self._num = num-1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6363
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6363&view=rev
Author: dmkaplan
Date: 2008年11月05日 14:43:29 +0000 (2008年11月05日)
Log Message:
-----------
Adding a small script that demonstrates the utility of transform_angles method added in last
commit (from dmkaplan).
Added Paths:
-----------
 trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py
Added: trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py	 (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py	2008年11月05日 14:43:29 UTC (rev 6363)
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+"""
+Text objects in matplotlib are normally rotated with respect to the
+screen coordinate system (i.e., 45 degrees rotation plots text along a
+line that is inbetween horizontal and vertical no matter how the axes
+are changed). However, at times one wants to rotate text with respect
+to something on the plot. In this case, the correct angle won't be
+the angle of that object in the plot coordinate system, but the angle
+that that object APPEARS in the screen coordinate system. This angle
+is found by transforming the angle from the plot to the screen
+coordinate system, as shown in the example below.
+"""
+from pylab import *
+
+# Plot diagonal line (45 degrees)
+h = plot( r_[:10], r_[:10] )
+
+# set limits so that it no longer looks on screen to be 45 degrees
+xlim([-10,20])
+
+# Locations to plot text
+l1 = array((1,1))
+l2 = array((5,5))
+
+# Rotate angle
+angle = 45
+trans_angle = gca().transData.transform_angles(array((45,)),
+ l2.reshape((1,2)))[0]
+
+# Plot text
+th1 = text(l1[0],l1[1],'text not rotated correctly',fontsize=16,
+ rotation=angle)
+th2 = text(l2[0],l2[1],'text not rotated correctly',fontsize=16,
+ rotation=trans_angle)
+
+show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <dmk...@us...> - 2008年11月05日 14:02:13
Revision: 6362
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6362&view=rev
Author: dmkaplan
Date: 2008年11月05日 14:02:07 +0000 (2008年11月05日)
Log Message:
-----------
Added a method to class Transforms in transform.py that transforms
angles. The generic method uses a generic algorithm involving pushing
off from a group of locations to determine new angles. This should
work with almost any transform, but much quicker algorithms can be
found for affine transforms. These algorithms have not yet been added
though, so the generic method will be used until they are.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py	2008年11月04日 13:38:15 UTC (rev 6361)
+++ trunk/matplotlib/lib/matplotlib/transforms.py	2008年11月05日 14:02:07 UTC (rev 6362)
@@ -1131,6 +1131,63 @@
 """
 return Path(self.transform_non_affine(path.vertices), path.codes)
 
+ def transform_angles(self, angles, pts, radians=False, pushoff=1e-5):
+ """
+ Performs transformation on a set of angles anchored at
+ specific locations.
+
+ The *angles* must be a column vector (i.e., numpy array).
+
+ The *pts* must be a two-column numpy array of x,y positions
+ (angle transforms currently only work in 2D). This array must
+ have the same number of rows as *angles*.
+
+ *radians* indicates whether or not input angles are given in
+ radians (True) or degrees (False; the default).
+
+ *pushoff* is the distance to move away from *pts* for
+ determining transformed angles (see discussion of method
+ below).
+
+ The transformed angles are returned in an array with the same
+ size as *angles*.
+
+ The generic version of this method uses a very generic
+ algorithm that transforms *pts*, as well as locations very
+ close to *pts*, to find the angle in the transformed system.
+ """
+ # Must be 2D
+ if self.input_dims <> 2 or self.output_dims <> 2:
+ raise NotImplementedError('Only defined in 2D')
+
+ # pts must be array with 2 columns for x,y
+ assert pts.shape[1] == 2
+
+ # angles must be a column vector and have same number of
+ # rows as pts
+ assert np.prod(angles.shape) == angles.shape[0] == pts.shape[0]
+
+ # Convert to radians if desired
+ if not radians:
+ angles = angles / 180.0 * np.pi
+
+ # Move a short distance away
+ pts2 = pts + pushoff * np.c_[ np.cos(angles), np.sin(angles) ]
+
+ # Transform both sets of points
+ tpts = self.transform( pts )
+ tpts2 = self.transform( pts2 )
+
+ # Calculate transformed angles
+ d = tpts2 - tpts
+ a = np.arctan2( d[:,1], d[:,0] )
+
+ # Convert back to degrees if desired
+ if not radians:
+ a = a * 180.0 / np.pi
+
+ return a
+
 def inverted(self):
 """
 Return the corresponding inverse transformation.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 6 results of 6

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /