-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
2D Normalization & Colormapping for ScalerMappables #8738
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
201dc2a
Initailize class 2D norm
patniharshit 7217536
Change name of class to BivariateNorm, take normalizer instances sepa…
patniharshit 0178730
Bivariate works with imshow, pcolor, pcolormesh, pcolorfast
patniharshit 575a244
add blank line between bivariate classes
patniharshit 8425637
Add support for bivariate in scatter
patniharshit 4a5831d
Fix missing norm2 in BivaraiteNorm
patniharshit 85df736
Fixed bug in if condition bivariate mapping
patniharshit 8e1bc63
Add autoscale, autoscale_None, scaled methods for BivariateNorm
patniharshit a9aace3
trying to show ticks and labels on both x and y axis
patniharshit 55a7a68
commented outline code, changed gridspace to show sqaure colorbar
patniharshit c2eb617
2d colorbar printing now
patniharshit daef751
Add code for Colorsquare
patniharshit 96af3d3
Modify axis aspect and fraction for colorsquare
patniharshit 9285372
fix failing commits
patniharshit 01b5932
Change PEP8 violations
patniharshit 28288e2
Revert isBivari, remove classic locator
patniharshit ca2b111
Subclass normalizers from Abstract Base Class
patniharshit 75b4eba
move _ticker function inside update_ticks
patniharshit bf65847
move _ticker function inside update_ticks
patniharshit f9dc4b1
remove cmap in imshow and pcolorfast
patniharshit 8a985f0
Defer call to norm and cmap in imshow
patniharshit 8f6928d
Fix bivariate handling with pcolormesh
patniharshit d54cb44
Make pcolor work with bivariate
patniharshit 4d03552
Do 2D->1D mapping in call method of colormap
patniharshit 2573610
Use list comprehensions to ravel
patniharshit 9228480
Reflect on reviews
patniharshit 5c8dc65
Update docstrings
patniharshit 21ea65f
Add bivariate example
patniharshit b8d43a9
Treat one as slightly less than one
patniharshit 7681d14
Change conditions for bivar
patniharshit 59f56af
Add image comparison test for bivariate
patniharshit f98978f
Update is_bivar condition to expect either BivariateNorm or Bivariate…
patniharshit 75a289f
Add line continuation in docstrings
patniharshit 7803974
Debug doc build fail
patniharshit e40c87b
Add missing symbols in docs
patniharshit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add bivariate example
- Loading branch information
commit 21ea65fefd1442e59c508aaae9f4338c6306572f
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
=========== | ||
Bivariate Demo | ||
=========== | ||
|
||
Plotting bivariate data. | ||
|
||
imshow, pcolor, pcolormesh, pcolorfast allows you to plot bivariate data | ||
using a bivaraite colormap. | ||
|
||
In this example we use imshow to plot air temperature with surface pressure | ||
alongwith a color square. | ||
""" | ||
import matplotlib.colors as colors | ||
from matplotlib.cbook import get_sample_data | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
|
||
############################################################################### | ||
# Bivariate plotting demo | ||
# ----------------------- | ||
|
||
air_temp = np.load(get_sample_data('air_temperature.npy')) | ||
surf_pres = np.load(get_sample_data('surface_pressure.npy')) | ||
|
||
fig, ax = plt.subplots() | ||
|
||
bivariate = [air_temp, surf_pres] | ||
|
||
cax = ax.imshow(bivariate, norm=colors.BivariateNorm(), | ||
cmap=colors.BivariateColormap()) | ||
|
||
# if input data is bivariate then colorbar automatically draws colorsquare | ||
# instead of colorbar | ||
cbar = fig.colorbar(cax, xlabel='air_temp', ylabel='surf_pres') | ||
|
||
plt.show() |
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
Binary file not shown.
Binary file not shown.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How big are these data files? I have a slight preference for 'generated' data for examples (to keep the repository size small).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
84.2 kB each.
Couldn't come up with generated data so used these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That isn't too bad, suspect that is smaller than the test images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One argument in favour of this can be that the user seeing the example might relate to use case of bivariate plotting better with a real world example than with some mathematical function.