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
(8)
2
3
4
(1)
5
(2)
6
(7)
7
(3)
8
(7)
9
(3)
10
(2)
11
(4)
12
(9)
13
14
15
16
17
(5)
18
(1)
19
20
21
22
23
24
25
26
27
28





Showing 1 results of 1

From: <wea...@us...> - 2011年02月18日 19:28:35
Revision: 8988
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8988&view=rev
Author: weathergod
Date: 2011年02月18日 19:28:29 +0000 (2011年2月18日)
Log Message:
-----------
scatter() now supports empty arrays as input (i.e., scatter([], []) is now valid).
Enabling this required fixes in both scatter() and in collections.py.
Collections now support empty versions of themselves more correctly due to these fixes.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2011年02月17日 16:44:28 UTC (rev 8987)
+++ trunk/matplotlib/CHANGELOG	2011年02月18日 19:28:29 UTC (rev 8988)
@@ -1,3 +1,6 @@
+2011年02月18日 scatter([], []) is now valid. Also fixed issues
+ with empty collections - BVR
+
 2011年02月07日 Quick workaround for dviread bug #3175113 - JKS
 
 2011年02月05日 Add cbook memory monitoring for Windows, using
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2011年02月17日 16:44:28 UTC (rev 8987)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2011年02月18日 19:28:29 UTC (rev 8988)
@@ -5832,24 +5832,17 @@
 else:
 collection.autoscale_None()
 
- temp_x = x
- temp_y = y
-
- minx = np.amin(temp_x)
- maxx = np.amax(temp_x)
- miny = np.amin(temp_y)
- maxy = np.amax(temp_y)
-
- w = maxx-minx
- h = maxy-miny
-
 # the pad is a little hack to deal with the fact that we don't
 # want to transform all the symbols whose scales are in points
 # to data coords to get the exact bounding box for efficiency
 # reasons. It can be done right if this is deemed important
- padx, pady = 0.05*w, 0.05*h
- corners = (minx-padx, miny-pady), (maxx+padx, maxy+pady)
- self.update_datalim( corners)
+ # Also, only bother with this padding if there is anything to draw.
+ if self._xmargin < 0.05 and x.size > 0 :
+ self.set_xmargin(0.05)
+
+ if self._ymargin < 0.05 and x.size > 0 :
+ self.set_ymargin(0.05)
+
 self.autoscale_view()
 
 # add the collection last
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2011年02月17日 16:44:28 UTC (rev 8987)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2011年02月18日 19:28:29 UTC (rev 8988)
@@ -59,6 +59,8 @@
 scalar mappable will be made to set the face colors.
 """
 _offsets = np.array([], np.float_)
+ # _offsets must be a Nx2 array!
+ _offsets.shape = (0, 2)
 _transOffset = transforms.IdentityTransform()
 _transforms = []
 
@@ -95,10 +97,11 @@
 
 self._uniform_offsets = None
 self._offsets = np.array([], np.float_)
+ # Force _offsets to be Nx2
+ self._offsets.shape = (0, 2)
 if offsets is not None:
 offsets = np.asarray(offsets)
- if len(offsets.shape) == 1:
- offsets = offsets[np.newaxis,:] # Make it Nx2.
+ offsets.shape = (-1, 2) # Make it Nx2
 if transOffset is not None:
 self._offsets = offsets
 self._transOffset = transOffset
@@ -148,13 +151,17 @@
 transOffset = self._transOffset
 offsets = self._offsets
 paths = self.get_paths()
+
+
 if not transform.is_affine:
 paths = [transform.transform_path_non_affine(p) for p in paths]
 transform = transform.get_affine()
 if not transOffset.is_affine:
 offsets = transOffset.transform_non_affine(offsets)
 transOffset = transOffset.get_affine()
+
 offsets = np.asarray(offsets, np.float_)
+ offsets.shape = (-1, 2) # Make it Nx2
 
 result = mpath.get_path_collection_extents(
 transform.frozen(), paths, self.get_transforms(),
@@ -176,6 +183,7 @@
 offsets = self._offsets
 paths = self.get_paths()
 
+
 if self.have_units():
 paths = []
 for path in self.get_paths():
@@ -184,17 +192,19 @@
 xs = self.convert_xunits(xs)
 ys = self.convert_yunits(ys)
 paths.append(mpath.Path(zip(xs, ys), path.codes))
- if len(self._offsets):
- xs = self.convert_xunits(self._offsets[:,0])
- ys = self.convert_yunits(self._offsets[:,1])
+
+ if offsets.size > 0:
+ xs = self.convert_xunits(offsets[:,0])
+ ys = self.convert_yunits(offsets[:,1])
 offsets = zip(xs, ys)
 
 offsets = np.asarray(offsets, np.float_)
+ offsets.shape = (-1, 2) # Make it Nx2
 
 if not transform.is_affine:
 paths = [transform.transform_path_non_affine(path) for path in paths]
 transform = transform.get_affine()
- if not transOffset.is_affine:
+ if not transOffset.is_affine :
 offsets = transOffset.transform_non_affine(offsets)
 transOffset = transOffset.get_affine()
 
@@ -258,8 +268,7 @@
 ACCEPTS: float or sequence of floats
 """
 offsets = np.asarray(offsets, np.float_)
- if len(offsets.shape) == 1:
- offsets = offsets[np.newaxis,:] # Make it Nx2.
+ offsets.shape = (-1, 2) # Make it Nx2
 #This decision is based on how they are initialized above
 if self._uniform_offsets is None:
 self._offsets = offsets
@@ -1221,6 +1230,7 @@
 offsets = zip(xs, ys)
 
 offsets = np.asarray(offsets, np.float_)
+ offsets.shape = (-1, 2) # Make it Nx2
 
 self.update_scalarmappable()
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 1 results of 1

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 によって変換されたページ (->オリジナル) /