contour: map extended ranges to "under" and "over" values#1022
Merged
efiring merged 4 commits intomatplotlib:masterfrom Jul 24, 2012
Merged
contour: map extended ranges to "under" and "over" values#1022efiring merged 4 commits intomatplotlib:masterfrom
efiring merged 4 commits intomatplotlib:masterfrom
Conversation
Contourf was handling the extend kwarg by mapping the extended ranges directly into the 0-1 normal colormap range, so that using set_under and set_over had no effect. The legend support for extend options was also using the wrong names for the options.
lib/matplotlib/contour.py
Outdated
Member
There was a problem hiding this comment.
I hate magic numbers like this. Maybe we could use np.INF and np.NINF?
Member
Author
There was a problem hiding this comment.
On 2012/07/20 5:20 PM, Benjamin Root wrote:
if self.extend in ('both', 'min'):
self.layers[0] = 0.5 \* (self.vmin + self._levels[1])self.layers[0] = -1e300I hate magic numbers like this. Maybe we could use np.INF and np.NINF?
I thought of that, and may yet do so; but I wanted to get out a fix that
would work, and could not take time to test whether potentially
dangerous things like INF would cause trouble in practice. Note that mpl
has other somewhat arbitrary special numbers, because they make it work
most of the time.
Also removed "from pylab import *".
Note that trying to simplify the code further by using np.inf a few lines above, in self._levels, does not work; I'm not sure what it breaks, but it definitely breaks something, probably in the colorbar code.
efiring
added a commit
that referenced
this pull request
Jul 24, 2012
contour: map extended ranges to "under" and "over" values
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contourf was handling the extend kwarg by mapping the extended
ranges directly into the 0-1 normal colormap range, so that
using set_under and set_over had no effect; after this change, the
extended ranges are mapped outside the 0-1 range (after applying
the norm) so that the colors established by the set_under and set_over
colormap methods are used. By default, these are the end values of
the colormap. The new behavior matches the existing contourf documentation.
Fixed a bug in which the legend support for extend options was using the
wrong names for the options.