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

Secondary axis does not show minor ticks. #14443

Closed
Milestone
@Knusper

Description

@Knusper

Bug report

Bug summary

Matplotlib 3.1 introduced a new method for adding a secondary axes withAxes.axes.secondary_xaxis andAxes.axes.secondary_xaxis. However, the.minorticks_on() method does nothing on those axes.

Code for reproduction

I use the example provided in the gallery --https://matplotlib.org/3.1.0/gallery/subplots_axes_and_figures/secondary_axis.html -- but modify it to show minor ticks.

importmatplotlib.pyplotaspltimportnumpyasnpfig,ax=plt.subplots(constrained_layout=True)x=np.arange(0,360,1)y=np.sin(2*x*np.pi/180)ax.plot(x,y)ax.set_xlabel('angle [degrees]')ax.set_ylabel('signal')ax.set_title('Sine wave')defdeg2rad(x):returnx*np.pi/180defrad2deg(x):returnx*180/np.pisecax=ax.secondary_xaxis('top',functions=(deg2rad,rad2deg))secax.set_xlabel('angle [rad]')ax.minorticks_on()secax.minorticks_on()plt.show()

Actual outcome

Screenshot_2019-06-04_19-20-05

Expected outcome

The top axis is expected to have minor ticks.

Matplotlib version

  • Operating system: Linux 4.9.0-9-amd64Fix autofmt_xdate() when using in conjunction with twinx() #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux
  • Matplotlib version: 3.1.0 (conda default channel)
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: Python 3.6.8 |Anaconda custom (64-bit)|

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp