Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Bug]: Hexbin hbar and vbar not updating correctly on changed #28633

Open
@trygvrad

Description

@trygvrad

Bug summary

A hexbar withmarginals=True has independent norms on the hexbins and the hbar and vbar unless vmin/vmax is set manually.
However, if the a changed signal is called, the behavior changes, and vmin/vmax is updated on the hbar and vbar to be equal to the vmin/vmax on main.

Aditionally, there is a bug so that the

Code for reproduction

# based on test_axes.py -- test_hexbin_linear()importmatplotlib.pyplotaspltimportnumpyasnpnp.random.seed(19680801)n=100000x=np.random.standard_normal(n)y=2.0+3.0*x+4.0*np.random.standard_normal(n)fig,axes=plt.subplots(2,1,figsize=(9,9))cs=axes[0].hexbin(x,y,gridsize=(10,5),marginals=True,reduce_C_function=np.sum)fig.colorbar(cs.hbar).set_label('hbar')fig.colorbar(cs.vbar).set_label('vbar')fig.colorbar(cs).set_label('main')cs=axes[1].hexbin(x,y,gridsize=(10,5),marginals=True,reduce_C_function=np.sum)cs.set_cmap('rainbow')fig.colorbar(cs.hbar).set_label('hbar')fig.colorbar(cs.vbar).set_label('vbar')fig.colorbar(cs).set_label('main')

Actual outcome

image
Only two of three colorbars change, and the limits are changed on the vbar.

Expected outcome

All three colorbars in the lower plot should change, but the limits should not update

Additional information

This bug came up as I was looking at this code in relation to the newdata→color pipeline suggested in#28428.
I can find no report on this bug by actual users, so I don't think it needs a quick resolution.

  • If the newdata→color pipeline discussed inVectorMappable with data type objects #28428 is approved, this bug will be resolved as part of this.
  • If the newdata→color pipeline is not approved, a small bugfix for this issue could be made (good first issue?)

The relevant code is in _axes.py, in the functionhexbin() which includes

defon_changed(collection):collection.hbar.set_cmap(collection.get_cmap())collection.hbar.set_cmap(collection.get_cmap())collection.vbar.set_clim(collection.get_clim())collection.vbar.set_clim(collection.get_clim())collection.callbacks.connect('changed',on_changed)

wherehbar andvbar is used in the wrong order.
However, only updating this will not resolve the issue where changing the colorbar changes the limits on the hbar and vbar in the case where these limits have not been set.

Operating system

No response

Matplotlib Version

3.8.2, matplotlib-dev

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

git checkout

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp