Skip to content

TwoSlopeNorm incompatible with proplot axes + xarray commands #404

Open
@zxdawn

Description

@zxdawn

Description

The TwoSlopeNorm doesn't work with proplot.

Steps to reproduce

import numpy as np
import proplot as pplt
from matplotlib.colors import TwoSlopeNorm
import xarray as xr

x, y = np.meshgrid(np.linspace(0,50,51), np.linspace(0,50,51))
z = np.linspace(-2,4,50*50).reshape(50,50)

newnorm = TwoSlopeNorm(vmin=-1, vcenter=0, vmax=3)

fig, axs = pplt.subplots()
xr.DataArray(z).plot(ax=axs, vmin=-1, vmax=3, norm=newnorm, cmap="RdBu_r", discrete=False)

Expected behavior:

image

Actual behavior:

image

Equivalent steps in matplotlib

# your code here, if applicable
import matplotlib.pyplot as plt

pc = plt.pcolormesh(x,y,z, norm=newnorm, cmap="RdBu_r")
plt.colorbar(pc)

Proplot version

Paste the results of import matplotlib; print(matplotlib.__version__); import proplot; print(proplot.version) here.

3.5.2
0.9.5.post332

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