Skip to content

Change in colorbar extensions #5524

Closed
Closed

Description

@mdboom

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?

Activity

  1. added this to the milestone on Nov 19, 2015
  2. efiring commented on Nov 19, 2015

    @efiring
    Member

    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.

  3. added a commit that references this issue on Nov 20, 2015
    92b937f
  4. self-assigned this
    on Nov 20, 2015
  5. added a commit that references this issue on Nov 20, 2015
    a9a4683
  6. added a commit that references this issue on Nov 22, 2015
    37182ee
  7. added 2 commits that reference this issue on Nov 22, 2015
    d1f525c
    1500e4b
  8. added a commit that references this issue on Nov 22, 2015
    f90367a
  9. 1 remaining item

  10. assigned and unassigned on Nov 23, 2015
  11. mdboom commented on Nov 23, 2015

    @mdboom
    MemberAuthor

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

  12. added 2 commits that reference this issue on Nov 23, 2015
    d2b6de1
    9b2c453
  13. reopened this on Nov 30, 2015
  14. tacaswell commented on Nov 30, 2015

    @tacaswell
    Member

    Wait, what did I do?

  15. mdboom commented on Nov 30, 2015

    @mdboom
    MemberAuthor

    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.

  16. added 2 commits that reference this issue on Dec 3, 2015
    cbec18a
    046596c
  17. added a commit that references this issue on Dec 6, 2015
    ca892ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions