'How to double y axis ticks?

How to double y axis ticks in subplots? I tried:

import matplotlib.pyplot as plt

fig, (a1, a2) = plt.subplots(figsize = (10,10), nrows=2, ncols=1)

x = [4215, 4565, 4800]
y = [20, 35, 55]
a1.plot(x, y)
a2.plot(x, y)

# Mirroring of axes

ax1 = a1.twiny()
ax2 = ax1.twiny()
ax2.yaxis.set_label_position('right')
    
plt.show()

enter image description here

x-axis is doubled instead of y-axis and the values are different.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source