Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: invert_yaxis function cannot invert the "over value" in colorbar axes #22052

Closed
@PKUliubaojian

Description

@PKUliubaojian

Bug summary

The "over value" and the "under value" of colormap are not correctly shown when using ax.invert_yaxis (invert_xaxis if the colorbar is horizontal) function.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
im=plt.imshow(np.arange(10000).reshape(100,100),vmax=9000,vmin=1000)
cb=plt.colorbar(im,extend='both')
cb.ax.invert_yaxis()

Actual outcome

image

Expected outcome

The "over value" and the "under value" could be shown in the right location by the way. The "under value" is expected to be at the top, if the y axis is reverted.

If this is not a bug, would it be a feature?

Additional information

No response

Operating system

CentOs

Matplotlib Version

3.5.0

Matplotlib Backend

No response

Python version

3.9.7

Jupyter version

No response

Installation

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions