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

Move towards having get_shared_{x,y}_axes return immutable views.#21584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jklymak merged 1 commit intomatplotlib:mainfromanntzer:gmf
Jun 2, 2022

Conversation

anntzer
Copy link
Contributor

Directly calling join() on the Groupers is not sufficient to share axes,
anyways, so don't let users do that.

Seehttps://gitter.im/matplotlib/matplotlib?at=618bf31f9d20982e4f10df53.

PR Summary

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

Directly calling join() on the Groupers is not sufficient to share axes,anyways, so don't let users do that.
@jklymakjklymak merged commit925b056 intomatplotlib:mainJun 2, 2022
@anntzeranntzer deleted the gmf branchJune 2, 2022 16:41
tylerjereddy added a commit to tylerjereddy/darshan that referenced this pull requestSep 28, 2022
* when using latest stable matplotlib our testsuiteproduces hundreds of warnings like this:```tests/test_data_access_by_filesystem.py: 54 warningstests/test_summary.py: 99 warnings  /home/tyler/python_310_darshan_venv/lib/python3.10/site-packages/darshan/experimental/plots/data_access_by_filesystem.py:536:MatplotlibDeprecationWarning: The join function was deprecated inMatplotlib 3.6 and will be removed two minor releases later.    ax_filesystem_counts.get_shared_x_axes().join(ax_filesystem_counts,list_count_axes[row - 1])```* this originates from this upstream PR:matplotlib/matplotlib#21584* turn this warning into an error in our CI, to preventfurther introductions of the deprecated functionality,and fix it up where we already use it, based on thedirections in the PR above
@jklymak
Copy link
Member

Hmmmm, not sure about this now. What is the equivalent ofax.get_shared_x_axes().remove(ax) to take an axes out of a share group?https://stackoverflow.com/questions/54915124/how-to-unset-sharex-or-sharey-from-two-axes-in-matplotlib

@anntzer
Copy link
ContributorAuthor

anntzer commentedApr 11, 2023
edited
Loading

I don't really want to support unsharing, see e.g.#15287 and especially#9923: the semantics are not trivial.
Admittedly the linked case is well defined (the removed axes is not shared with anyone else and all other shares remain), but if we want to support that we should have a better API that makes clear what happen when, in a state where A shares B and B shares C, we remove B from the group (does A stay shared with C?). (This is discussed at length in#9923.)

PS: Feel free to re-ping me on old issues/prs if needed, I tend to unsubscribe from them once they are closed/merged.

@cvanelteren
Copy link

cvanelteren commentedApr 17, 2025
edited
Loading

@anntzer I am running into an issue where I need the ability to unshare axes. I have been messing around with the api for a while to get it to work but can't seem to toggle the ticklabels back on. Is there some hacky way to get the ticklabels to behave independently again?

This is what I was playing around with

code
importultraplotasupltfrommatplotlibimportcbookimportnumpyasnpfrommatplotlibimporttickerasmtickerfrommatplotlib.axisimportTickerfig,ax=uplt.subplots(ncols=2,nrows=2,wspace=5,hspace=5)# ax[0]._shared_axes["x"] = cbook.Grouper()print(list(ax[0]._shared_axes.keys()))data=np.random.rand(2,100)foraxiinrange(0,4):d=data+axi*100ax[axi].scatter(*d)print(ax[0].xaxis.offsetText)# print(ax[0].xaxis._ticks.foridxinrange(4):axi=ax[idx]axi._shared_axes["y"]=cbook.Grouper()axi._shared_axes["x"]=cbook.Grouper()axi._shared_axes["z"]=cbook.Grouper()axi._shared_axes["view"]=cbook.Grouper()foridxinrange(4):axi=ax[idx]axi.xaxis.reset_ticks()axi.yaxis.reset_ticks()axi.xaxis.major=Ticker()axi.yaxis.major=Ticker()axi.yaxis.minor=Ticker()axi.xaxis.minor=Ticker()axi.xaxis._set_scale(uplt.scale.LinearScale())axi.yaxis._set_scale(uplt.scale.LinearScale())axi.xaxis.offsetText.set_visible(True)axi.yaxis.offsetText.set_visible(True)axi.xaxis.offsetText.set_text("hello world")major_locs=axi.yaxis.get_majorticklocs()major_ticks=axi.yaxis.get_major_ticks()major_labels=axi.yaxis.major.formatter.format_ticks(major_locs)axi.tick_params(left=True,# right = True,bottom=True,# top = True,# labelleft = True,# labelright = True,# labelbottom = True,# labeltop = True,which="both",axis="both",    )print(axi.yaxis.get_tick_params())fortick,loc,labelinzip(major_ticks,major_locs,major_labels):tick.update_position(loc)tick.label1.set_text(label)tick.label2.set_text(label)axi.xaxis.set_major_locator(mticker.AutoLocator())axi.xaxis.set_major_formatter(mticker.ScalarFormatter())axi.xaxis.set_minor_locator(mticker.AutoMinorLocator())axi.xaxis.set_minor_formatter(mticker.NullFormatter())axi.yaxis.set_major_locator(mticker.AutoLocator())axi.yaxis.set_minor_locator(mticker.AutoMinorLocator())axi.xaxis.set_minor_formatter(mticker.NullFormatter())axi.yaxis.set_major_formatter(mticker.ScalarFormatter())axi.autoscale_view()# ax[1].scatter(*data)# for axj in axi:# print(axj.number)/

any help would be appreciated!

@anntzer
Copy link
ContributorAuthor

Unsharing is complicated to say the least, see e.g.#9923

@cvanelteren
Copy link

@anntzer I read up on the issue spread across multiple pages on matplotlib. The one you listed is very helpful indeed. In my case I'm not interested in maintaining the transitive properties and merely would like to isolate the axes. I just can't figure out why the axes label behave so strangy.

From the API I can see that we get shallow copy of the minor and major tickets which I believe I reset here. Is there a way to rebuild them that would achieve an axis isolation procedure?

@anntzer
Copy link
ContributorAuthor

I don't have a quick reply available, you may have more luck opening a new issue to discuss your problem.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.6.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@jklymak@cvanelteren@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp