Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Rewrite of image infrastructure#5718
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
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
cf11aea3b7d1bbc9cae504a053020aa222a0793aa21384c7c9148c7f820479efad84c864e84ea0be04c0a8643f15df79f0b436f1adfbc39d9d3b468f9d85347b32cd86e60ebfdc66ed07cccfb35073f6e625e80ac778cfc9fe6658d61ac2ab3318fdffbbf05fbb55c834d6cc84c5a3bf944820883f4bc9d5030a455c1abbfe376c45266fde9285c3ae2b2bbeb8946834e43c8b8665697d21a6ed2d2a1266d3518a0b8d6930f43f68cd0e7e0e62832fe7d54d53e532e1cfad8d9e52c26f0469ab7b391f0889365c17f2f3759827d1f5be66debd521cdd6b22a5fff1d66da6c00bc9b2425File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2360,33 +2360,21 @@ def draw(self, renderer=None, inframe=False): | ||
| # make a composite image, blending alpha | ||
| # list of (mimage.Image, ox, oy) | ||
| # composite images need special args so they will not | ||
| # respect z-order for now | ||
| zorder_images = [im for im in self.images if im.get_visible()] | ||
| zorder_images.sort(key=lambda x: x.zorder) | ||
| data, l, b = mimage.composite_images( | ||
| zorder_images, renderer, renderer.get_image_magnification()) | ||
| gc = renderer.new_gc() | ||
| gc.set_clip_rectangle(self.bbox) | ||
| gc.set_clip_path(mtransforms.TransformedPath( | ||
| self.patch.get_path(), | ||
| self.patch.get_transform())) | ||
| renderer.draw_image(gc, round(l), round(b),data) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Just curious, at what zorder does the composed image end up at? MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It ends up at the zorder of the first image in the list. You can see Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. maybe draw it at the average zorder? This is the time to break that sort of thing. MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Alternatively, I was thinking that we should only composite images at thesame zorder. In the normal case (where the zorder didn't change from the default) that will be the case. In the case of tinkering with zorder, the user will really care about getting it right and we can either (1) create multiple composites for each zorder "grouping" or (2) just turn off compositing if the images are at different zorders. | ||
| gc.restore() | ||
| if dsu_rasterized: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -203,7 +203,7 @@ def __init__(self, norm=None, cmap=None): | ||
| self.colorbar = None | ||
| self.update_dict = {'array': False} | ||
| def to_rgba(self, x, alpha=None, bytes=False, norm=True): | ||
| """ | ||
| Return a normalized rgba array corresponding to *x*. | ||
| @@ -258,9 +258,14 @@ def to_rgba(self, x, alpha=None, bytes=False): | ||
| # This is the normal case, mapping a scalar array: | ||
| x = ma.asarray(x) | ||
| if norm: | ||
| x = self.norm(x) | ||
| rgba = self.cmap(x, alpha=alpha, bytes=bytes) | ||
| # For floating-point greyscale images, we treat negative as | ||
| # transparent so we copy that over to the alpha channel | ||
| if x.ndim == 2 and issubclass(x.dtype.type, np.floating): | ||
| rgba[:, :, 3] = np.where(x < 0.0, 0, rgba[:, :, 3]) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. There has got to be a clearer way to write this, but I am not sure of the numpy indexing rules are when mixing boolean indexes and integer indexes. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Looks identical to MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Thanks -- I'll change that. Those crazy indexing tricks in Numpy always evade me. | ||
| return rgba | ||
| def set_array(self, A): | ||
| 'Set the image array from numpy array *A*' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -32,7 +32,7 @@ | ||
| from matplotlib.cbook import Stack, iterable | ||
| from matplotlib importimage as mimage | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Actually, it might make sense to keep it as Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. eh, people should not be bulk importing from Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Well, then On Wed, Jan 6, 2016 at 1:53 PM, Thomas A Caswellnotifications@github.com
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I sometimes have thoughts that Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. " lib/matplotlib/tests/baseline_images/test_backend_svg/noscale.png" On Wed, Jan 6, 2016 at 2:11 PM, Thomas A Caswellnotifications@github.com
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I think it's best to use our MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
The change is due to the fact that the backend-specific | ||
| from matplotlib.image import FigureImage | ||
| import matplotlib.colorbar as cbar | ||
| @@ -1255,21 +1255,13 @@ def draw(self, renderer): | ||
| # make a composite image blending alpha | ||
| # list of (_image.Image, ox, oy) | ||
| mag = renderer.get_image_magnification() | ||
| data, l, b = mimage.composite_images(self.images, renderer, mag) | ||
| def draw_composite(): | ||
| gc = renderer.new_gc() | ||
| gc.set_clip_rectangle(self.bbox) | ||
| gc.set_clip_path(self.get_clip_path()) | ||
| renderer.draw_image(gc, l, b,data) | ||
| gc.restore() | ||
| dsu.append((self.images[0].get_zorder(), self.images[0], | ||
Uh oh!
There was an error while loading.Please reload this page.