Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
cf11aea
Remove Image class. Replace with resample func
mdboom Dec 22, 2015
3b7d1bb
Agg backend shouldn't do its own image interp
mdboom Dec 22, 2015
c9cae50
Update interpolation_methods.py to use viridis
mdboom Dec 22, 2015
4a05302
Remove svg.image_noscale rcParam
mdboom Dec 22, 2015
0aa222a
Rewrite image classes
mdboom Dec 22, 2015
0793aa2
Update backends for new API
mdboom Dec 22, 2015
1384c7c
Use transforms to rotate image, not hack
mdboom Dec 22, 2015
9148c7f
Update tests
mdboom Dec 22, 2015
820479e
Decrease generated code size
mdboom Dec 22, 2015
fad84c8
Remove explicit LICENSE.
mdboom Dec 22, 2015
64e84ea
Numpy 1.6 compatibility
mdboom Dec 30, 2015
0be04c0
Add Agg filter test
mdboom Dec 30, 2015
a8643f1
Fix formatting
mdboom Dec 30, 2015
5df79f0
Mark test as known fail on Numpy 1.6
mdboom Dec 30, 2015
b436f1a
Update draw_image API doc
mdboom Dec 30, 2015
dfbc39d
Fix reference counting
mdboom Dec 30, 2015
9d3b468
[skip-ci] PEP8
mdboom Dec 30, 2015
f9d8534
Update what's new
mdboom Dec 30, 2015
7b32cd8
Fix demo_annotation_box.py
mdboom Dec 30, 2015
6e60ebf
Fix #3057: Don't composite when interpolation == 'none'
mdboom Dec 30, 2015
dc66ed0
Remove broken example
mdboom Dec 30, 2015
7cccfb3
Support 16-bit grayscale
mdboom Dec 30, 2015
5073f6e
Fix permissions on demo_image_affine.py
mdboom Dec 31, 2015
625e80a
Fix alpha handling for interpolation == 'none'
mdboom Dec 31, 2015
c778cfc
Use `kind` instead of `issubclass`
mdboom Dec 31, 2015
9fe6658
Update docstring
mdboom Dec 31, 2015
d61ac2a
Revert change
mdboom Dec 31, 2015
b3318fd
Make demo_text_path.py work again
mdboom Dec 31, 2015
ffbbf05
Remove extraneous space
mdboom Dec 31, 2015
fbb55c8
Privatize self._images
mdboom Dec 31, 2015
34d6cc8
Simplify expression
mdboom Jan 1, 2016
4c5a3bf
Update docstring
mdboom Jan 1, 2016
9448208
Fix #5520: Don't round up if already rounded
mdboom Jan 5, 2016
83f4bc9
Merge pull request #17 from tacaswell/image-interpolation
mdboom Jan 4, 2016
d5030a4
Use abs() for NEAREST check
mdboom Jan 5, 2016
55c1abb
Image composite respecting z-order
mdboom Jan 5, 2016
fe376c4
Fix #4280: Preserve size when saving images
mdboom Jan 5, 2016
5266fde
Python 2.x fix
mdboom Jan 5, 2016
9285c3a
Update composite_images docstring
mdboom Jan 7, 2016
e2b2bbe
Refine can_composite
mdboom Jan 7, 2016
b894683
Improve make_image docstring
mdboom Jan 7, 2016
4e43c8b
Use X.ndim over len(X.shape)
mdboom Jan 7, 2016
8665697
Use float32 when applying alpha
mdboom Jan 7, 2016
d21a6ed
Use output.shape
mdboom Jan 7, 2016
2d2a126
Add unsampled kwarg everywhere
mdboom Jan 7, 2016
6d3518a
PEP8
mdboom Jan 7, 2016
0b8d693
Use super()
mdboom Jan 7, 2016
0f43f68
Put shape in exception
mdboom Jan 7, 2016
cd0e7e0
Case insensitive check for PNG extension
mdboom Jan 7, 2016
e62832f
Fix Numpy version check
mdboom Jan 7, 2016
e7d54d5
@cleanup unnecessary here
mdboom Jan 7, 2016
3e532e1
Make BboxImage work
mdboom Jan 7, 2016
cfad8d9
Reinstate strictness of test_imsave_color_alpha
mdboom Jan 7, 2016
e52c26f
PEP8
mdboom Jan 7, 2016
0469ab7
Fix has image test in Axes
mdboom Jan 7, 2016
b391f08
Refactor image compositing logic into a single function
mdboom Jan 7, 2016
89365c1
Properly handle NULL composite image
mdboom Jan 11, 2016
7f2f375
PEP8
mdboom Jan 11, 2016
9827d1f
Consistent handling of empty composite images
mdboom Jan 11, 2016
5be66de
Rename lena variable
mdboom Jan 29, 2016
bd521cd
Update docstring to reflect reality
mdboom Jan 29, 2016
d6b22a5
Address more minor comments in the PR
mdboom Feb 2, 2016
fff1d66
Increase tolerance on Windows
mdboom Feb 17, 2016
da6c00b
Increase tolerance of png_suite test
mdboom Feb 17, 2016
c9b2425
PEP8
mdboom Feb 17, 2016
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
Prev Previous commit
Next Next commit
Use kind instead of issubclass
  • Loading branch information
mdboom committed Feb 17, 2016
commit c778cfc520f9309858f80bf2cc6300b652516b06
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def post_processing(image, dpi):
img, ox, oy = post_processing(img.reshape((h, w, 4)) / 255.,
self.dpi)
gc = self.new_gc()
if issubclass(img.dtype.type, np.floating):
if img.dtype.kind == 'f':
img = np.asarray(img * 255., np.uint8)
img = img[::-1]
self._renderer.draw_image(
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
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):
if x.ndim == 2 and x.dtype.kind == 'f':
rgba[:, :, 3] = np.where(x < 0.0, 0, rgba[:, :, 3])
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks identical to rgba[:, :, 3][x < 0] = 0. No fancy indexing is required, and it is much faster than using where:

In [9]: xx = np.random.randn(1000, 1000, 4)

In [10]: x = xx[:, :, 0]

In [12]: timeit xx[:, :, 3][x < 0] = 0
100 loops, best of 3: 2.08 ms per loop

In [13]: timeit xx[:, :, 3] = np.where(x < 0, 0, xx[:, :, 3])
100 loops, best of 3: 9.65 ms per loop

Copy link
Member Author

Choose a reason for hiding this comment

The 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

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
if not unsampled:
if len(A.shape) == 2:
A = self.norm(A)
if issubclass(A.dtype.type, np.floating):
if A.dtype.kind == 'f':
# For floating-point greyscale images, we treat negative
# numbers as transparent.
output = np.empty((out_height, out_width), dtype=A.dtype)
Expand Down