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

Twinned axes do not allow setting of different formatters #7376

Closed
Labels
status: inactiveMarked by the “Stale” Github Action
@madphysicist

Description

@madphysicist

To help us understand and resolve your issue please check that you have provided
the information below.

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
    Matplotlib 1.51, Python 3.5.2 on Red Hat Enterprise Linux 6.5

  • How did you install Matplotlib and Python (pip, anaconda, from source ...)
    Anaconda 1.5.1 (conda 4.2.9)

  • If possible please supply aShort, Self Contained, Correct, Example
    that demonstrates the issue i.e a small piece of code which reproduces the issue
    and can be run with out any other (or as few as possible) external dependencies.

frommatplotlibimportpyplotaspltfrommatplotlib.tickerimportFormatter,MaxNLocatorax=plt.plot([0,1,2,3], [0,1,2,3])[0].axesax.figure.subplots_adjust(bottom=0.3)ax.set_xlabel('Axis1')# To demonstrate that labels can be set differentlyax2=ax.twinx()ax2.set_frame_on(True)ax2.patch.set_visible(False)ax2.yaxis.set_visible(False)ax2.xaxis.set_visible(True)ax2.spines['bottom'].set_position(('axes',-0.2))# So far so goodax2.set_xlabel('Axis2')# Surprisingly (or not), this worksclassF(Formatter):def__call__(self,x,pos=None):return'%03d'%x# This does not work as expected:ax.xaxis.set_major_locator(MaxNLocator(integer=True))# Both locators get modifiedax2.xaxis.set_major_formatter(F())# Both formatters get modified

I suspect that this has something to do with the fact thatAxis has aTicker container for the attributes that are behaving inappropriately, and that they are not being copied correctly when the axis is twinned for some reason. I have not been able to trace this problem down yet, but with a few pointer from the experts, I'd probably be able to make a PR. Assuming this is actually an issue, of course.

  • If this is an image generation bug attach a screenshot demonstrating the issue.
  • If this is a regression (Used to work in an earlier version of Matplotlib), please
    note where it used to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp