Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
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
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
Labels
No labels