-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Suppresses failed test case by excepting TypeError from _initialize_x_y #24698
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
TianzeMYou
wants to merge
1
commit into
matplotlib:main
from
TianzeMYou:uniform-field-contour-colorbar
Closed
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1240,8 +1240,18 @@ def _proportional_y(self): | |
if (isinstance(self.norm, colors.BoundaryNorm) or | ||
self.boundaries is not None): | ||
y = (self._boundaries - self._boundaries[self._inside][0]) | ||
y = y / (self._boundaries[self._inside][-1] - | ||
self._boundaries[self._inside][0]) | ||
|
||
# original | ||
# y = y / (self._boundaries[self._inside][-1] - | ||
# self._boundaries[self._inside][0]) | ||
|
||
# change | ||
if (self._boundaries[self._inside][-1] | ||
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. does this need an |
||
!= self._boundaries[self._inside][0]): | ||
y = y / (self._boundaries[self._inside][-1] - | ||
self._boundaries[self._inside][0]) | ||
|
||
|
||
# need yscaled the same as the axes scale to get | ||
# the extend lengths. | ||
if self.spacing == 'uniform': | ||
|
@@ -1262,10 +1272,15 @@ def _proportional_y(self): | |
yscaled = np.ma.filled(norm(yscaled), np.nan) | ||
# make the lower and upper extend lengths proportional to the lengths | ||
# of the first and last boundary spacing (if extendfrac='auto'): | ||
automin = yscaled[1] - yscaled[0] | ||
automax = yscaled[-1] - yscaled[-2] | ||
|
||
extendlength = [0, 0] | ||
if self._extend_lower() or self._extend_upper(): | ||
# change | ||
automin = yscaled[0] | ||
automax = yscaled[0] | ||
if len(yscaled) > 1: | ||
automin = yscaled[1] - yscaled[0] | ||
automax = yscaled[-1] - yscaled[-2] | ||
extendlength = self._get_extension_lengths( | ||
self.extendfrac, automin, automax, default=0.05) | ||
return y, extendlength | ||
|
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 |
---|---|---|
|
@@ -244,6 +244,18 @@ def test_contour_colorbar(): | |
fig.colorbar(CS, orientation='vertical') | ||
|
||
|
||
def test_contour_uniformfield_colorbar(): | ||
# Smoke test for issue | ||
fig, ax = plt.subplots() | ||
with pytest.warns(Warning) as record: | ||
cs = ax.contour([[2, 2], [2, 2]]) | ||
assert len(record) == 1 | ||
try: | ||
fig.colorbar(cs, ax=ax) | ||
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. Why is this in a try-except? |
||
except: | ||
pass | ||
|
||
|
||
@image_comparison(['cbar_with_subplots_adjust.png'], remove_text=True, | ||
savefig_kwarg={'dpi': 40}) | ||
def test_gridspec_make_colorbar(): | ||
|
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.
Please do not keep the original code around. Because the code is in git and there are a number of UIs (inculding this website) for viewing the diffs it is much clearer to simply remove the old code and replace it with the new code. If we kept the full history of Matplotib in-line like this it would very quickly become impossible to read!