Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Colorbars need tests... #16398

Copy link
Copy link
Open
Open
Copy link
@jklymak

Description

@jklymak
Issue body actions

Follow up to #16280, we need tests for colorbars. i.e.

@image_comparison(
     baseline_images=['colorbar_norms'], extensions=['png'])
 def test_cbar_norms():
     # Test colormaps with different norms
     norms = [mcolors.Normalize(vmin=-1, vmax=2),
              mcolors.BoundaryNorm(boundaries=[-1, 0, 1], ncolors=4),
              mcolors.LogNorm(vmin=1, vmax=1e4),
              mcolors.PowerNorm(gamma=0.2, vmin=0.1, vmax=0.6),
              mcolors.SymLogNorm(1, vmin=-10, vmax=10),
              mcolors.TwoSlopeNorm(1, vmin=0, vmax=2)]
     fig, axs = plt.subplots(ncols=len(norms), constrained_layout=True)
     for ax, norm in zip(axs, norms):
         fig.colorbar(cm.ScalarMappable(norm=norm, cmap='viridis'), cax=ax, extend='both')

but we can't do them yet because SymLogNorm (for instance) is not quite correct yet...

See also #16392, #16286 where this test originally came from...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.