Skip to content
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

Change in colorbar extensions #5524

Closed
mdboom opened this issue Nov 19, 2015 · 4 comments
Closed

Change in colorbar extensions #5524

mdboom opened this issue Nov 19, 2015 · 4 comments
Assignees
Milestone

Comments

@mdboom
Copy link
Member

mdboom commented Nov 19, 2015

In #5307, where I am lowering our testing tolerance down to zero, I am discovering a few recent changes that slipped through because the tolerance on our tests was too high.

In particular 8928311 introduced the following change in test_axes:test_contour_colorbar.

Current baseline image:

contour_colorbar-expected

Current behavior after 8928311:

contour_colorbar

The test code:

@image_comparison(baseline_images=['contour_colorbar'])
def test_contour_colorbar():
    x, y, z = contour_dat()

    fig = plt.figure()
    ax = fig.add_subplot(111)
    cs = ax.contourf(x, y, z, levels=np.arange(-1.8, 1.801, 0.2),
                     cmap=plt.get_cmap('RdBu'),
                     vmin=-0.6,
                     vmax=0.6,
                     extend='both')
    cs1 = ax.contour(x, y, z, levels=np.arange(-2.2, -0.599, 0.2),
                     colors=['y'],
                     linestyles='solid',
                     linewidths=2)
    cs2 = ax.contour(x, y, z, levels=np.arange(0.6, 2.2, 0.2),
                     colors=['c'],
                     linewidths=2)
    cbar = fig.colorbar(cs, ax=ax)
    cbar.add_lines(cs1)
    cbar.add_lines(cs2, erase=False)

@efiring: Do you know if this change was intentional?

@mdboom mdboom added this to the next major release (2.0) milestone Nov 19, 2015
@efiring
Copy link
Member

efiring commented Nov 19, 2015

Not intentional. The problem is that contour is using np.inf and -np.inf as added levels with 'extend' in _process_levels(). The simple solution is to use something like 1e300 and -1e300 instead.

@mdboom
Copy link
Member Author

mdboom commented Nov 23, 2015

#5546 is a solution based directly on @efiring's suggestion.

mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 23, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 27, 2015
@mdboom mdboom reopened this Nov 30, 2015
@tacaswell
Copy link
Member

Wait, what did I do?

@mdboom
Copy link
Member Author

mdboom commented Nov 30, 2015

I think this was a merging snafu (my fault). This was a commit that we later reverted, but it's still in there and when it was merged up closed this issue again.

mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 3, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 5, 2015
@mdboom mdboom closed this as completed in a9ca4b7 Dec 6, 2015
efiring added a commit that referenced this issue Dec 6, 2015
Fix #5524: Use large, but finite, values for contour extensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants