-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Corrected cax attributes of ImageGrid axes #3957
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
695f90e
Corrected cax attributes of ImageGrid axes
inclement d1bb217
Added ImageGrid test
inclement ccb53b0
Pep8 fixes in axes_grid test
inclement 9233c44
Updated axes_grid test for more parameters
inclement 9ea98f4
Fixed axes_grid cax based on cbar_edge
inclement 53da33c
Added AxesGrid tests file to default tests
inclement 59ee4bd
Added test result image for ImageGrid
inclement 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
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
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 added
BIN
+436 KB
lib/mpl_toolkits/tests/baseline_images/test_axes_grid/imagegrid_cbar_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,42 @@ | ||
|
||
from matplotlib.testing.decorators import image_comparison | ||
from mpl_toolkits.axes_grid1 import ImageGrid | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
|
||
@image_comparison(baseline_images=['imagegrid_cbar_mode'], | ||
extensions=['png'], | ||
remove_text=True) | ||
def test_imagegrid_cbar_mode_edge(): | ||
X, Y = np.meshgrid(np.linspace(0, 6, 30), np.linspace(0, 6, 30)) | ||
arr = np.sin(X) * np.cos(Y) + 1j*(np.sin(3*Y) * np.cos(Y/2.)) | ||
|
||
fig = plt.figure(figsize=(18, 9)) | ||
|
||
positions = (241, 242, 243, 244, 245, 246, 247, 248) | ||
directions = ['row']*4 + ['column']*4 | ||
cbar_locations = ['left', 'right', 'top', 'bottom']*2 | ||
|
||
for position, direction, location in zip(positions, | ||
directions, | ||
cbar_locations): | ||
grid = ImageGrid(fig, position, | ||
nrows_ncols=(2, 2), | ||
direction=direction, | ||
cbar_location=location, | ||
cbar_size='20%', | ||
cbar_mode='edge') | ||
ax1, ax2, ax3, ax4, = grid | ||
|
||
im1 = ax1.imshow(arr.real, cmap='spectral') | ||
im2 = ax2.imshow(arr.imag, cmap='hot') | ||
im3 = ax3.imshow(np.abs(arr), cmap='jet') | ||
im4 = ax4.imshow(np.arctan2(arr.imag, arr.real), cmap='hsv') | ||
|
||
# Some of these colorbars will be overridden by later ones, | ||
# depending on the direction and cbar_location | ||
ax1.cax.colorbar(im1) | ||
ax2.cax.colorbar(im2) | ||
ax3.cax.colorbar(im3) | ||
ax4.cax.colorbar(im4) |
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 9A67 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.
I think we only need to test one format here. PNG is a good candidate.