Closed
Description
Bug report
Bug summary
Matplotlib 3.1 introduced a new method for adding a secondary axes with Axes.axes.secondary_xaxis
and Axes.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.
import matplotlib.pyplot as plt
import numpy as np
fig, 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')
def deg2rad(x):
return x * np.pi / 180
def rad2deg(x):
return x * 180 / np.pi
secax = 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-amd64 Fix 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