Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[WIP] Quad mesh extent #3095#4017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletionslib/matplotlib/collections.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,8 +82,6 @@ class Collection(artist.Artist, cm.ScalarMappable):
_transOffset = transforms.IdentityTransform()
_transforms = []



def __init__(self,
edgecolors=None,
facecolors=None,
Expand DownExpand Up@@ -1501,7 +1499,7 @@ def _set_transforms(self):
self._transforms[:, 1, 0] = widths * sin_angle
self._transforms[:, 1, 1] = heights * cos_angle
self._transforms[:, 2, 2] = 1.0

_affine = transforms.Affine2D
if self._units == 'xy':
m = ax.transData.get_affine().get_matrix().copy()
Expand DownExpand Up@@ -1689,7 +1687,8 @@ def __init__(self, meshWidth, meshHeight, coordinates,

self._bbox = transforms.Bbox.unit()
self._bbox.update_from_data_xy(coordinates.reshape(
((meshWidth + 1) * (meshHeight + 1), 2)))
((meshWidth + 1) * (meshHeight + 1), 2)),
ignore=True)

# By converting to floats now, we can avoid that on every draw.
self._coordinates = self._coordinates.reshape(
Expand All@@ -1705,6 +1704,38 @@ def set_paths(self):
self._paths = self.convert_mesh_to_paths(
self._meshWidth, self._meshHeight, self._coordinates)

def get_window_extent(self, renderer):
# get a dummy bounding box
bbox = transforms.Bbox([[0, 0], [0, 0]])
# get the data and offset transforms
trans_data_to_xy = self.get_transform().transform
transOffset = self.get_offset_transform().transform
# convert the transforms to data-units
offsets = transOffset(self._offsets)

# deal with masked arrays
coordinates = self._coordinates
if ma.isMaskedArray(coordinates):
c = coordinates.data
else:
c = coordinates
# slice sets to pick out the corners of each patch
# bottom-left, top-left, top-right, bottom-right
slice_sets = ((slice(0, -1), slice(0, -1)),
(slice(0, -1), slice(1, None)),
(slice(1, None), slice(1, None)),
(slice(1, None), slice(0, -1))
)
# first time ignore the existing bounds
ignore = True
for x_slc, y_slc in slice_sets:
bbox.update_from_data_xy(
trans_data_to_xy(c[x_slc, y_slc].reshape(-1, 2) + offsets),
ignore=ignore)
# but on subsequent loops don't shrink the bounding box
ignore = False
return bbox

@staticmethod
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
"""
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp