twinx and twiny cannot remove yticklabels

I want to plot contours on top of an image, using twinx and twiny for the contour coordinates. I don’t want to show the x- and yticklabels for the contour coordinates. I find I can remove the xticklabels, but not the yticklabels. There is mention of this problem here:

but I wonder if there is now a solution?

The lines below illustrate the problem.

import matplotlib.pyplot as plt
import numpy as np

x1 = np.arange(10)
y1 = np.arange(20)
data1 = np.arange(x1.size * y1.size).reshape(y1.size, x1.size)

x2 = np.arange(10, 40)
y2 = np.arange(-20, 10)
data2 = np.sin(np.arange(x2.size * y2.size).reshape(x2.size, x2.size))

fig = plt.figure()

ax = fig.add_subplot(111)
ax.pcolormesh(x1, y1, data1)

ax2 = ax.twinx().twiny()
ax2.contour(x2, y2, data2, colors='k')
plt.setp(ax2.get_xticklabels(), visible=False)

# Neither of the lines below work
#plt.setp(ax2.get_yticklabels(), visible=False)
plt.setp(ax2.axes.yaxis.get_ticklabels(), visible=False)