Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dc752b3

Browse filesBrowse files
authored
Merge pull request #6677 from anntzer/copyless-pcolormesh
API/MNT: Remove a copy in pcolormesh Internal data can now be mutated externally.
2 parents 191277a + be37304 commit dc752b3
Copy full SHA for dc752b3

File tree

Expand file treeCollapse file tree

1 file changed

+3
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-6
lines changed

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,19 +1783,16 @@ def __init__(self, meshWidth, meshHeight, coordinates,
17831783
Collection.__init__(self, **kwargs)
17841784
self._meshWidth = meshWidth
17851785
self._meshHeight = meshHeight
1786-
self._coordinates = coordinates
1786+
# By converting to floats now, we can avoid that on every draw.
1787+
self._coordinates = np.asarray(coordinates, float).reshape(
1788+
(meshHeight + 1, meshWidth + 1, 2))
17871789
self._antialiased = antialiased
17881790
self._shading = shading
17891791

17901792
self._bbox = transforms.Bbox.unit()
17911793
self._bbox.update_from_data_xy(coordinates.reshape(
17921794
((meshWidth + 1) * (meshHeight + 1), 2)))
17931795

1794-
# By converting to floats now, we can avoid that on every draw.
1795-
self._coordinates = self._coordinates.reshape(
1796-
(meshHeight + 1, meshWidth + 1, 2))
1797-
self._coordinates = np.array(self._coordinates, float)
1798-
17991796
def get_paths(self):
18001797
if self._paths is None:
18011798
self.set_paths()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.