Dear all,
I would like to plot a figure with double x-axes.
Unfortunately, it seems the ticks of the second x axis do not fit with what I want.
Here the example:
import numpy as np
import matplotlib.pyplot as plt
MM = np.array([ 1., 2., 4., 8., 16., 32.])
SS = np.array([64., 32., 16., 8., 4., 2.])
RR = np.array([2813, 1544, 895, 562, 459,409])
ax = plt.subplot(111)
ax.grid(True,which="both",ls="-",color='0.6')
ax.plot(MM, RR ,'-r')
ax2 = ax.twiny()
ax2.invert_xaxis()
ax2.plot(MM, RR, 'none')
ax2.set_xticks([64,32,16,8,4,2])
ax2.set_xticklabels(['64','32','16','8','4','2'])
plt.show()
As it can be noticed, the value 32 in the ax2 does not correspond to the second value but is put in the middle point of ax2. I would like to have it in the same vertical line of the second value of MM. This of course not only for 32 but for the value in SS. Basically I would like to have the main axis according to MM and a second ax with SS value in the same line of MM values.
I hope I made myself clear.
really really thanks and,
best regards