double x-axis with defined xtick and inverse order

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

double x-axis with defined xtick and inverse order

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.plot(MM, RR  ,'-r')

ax2 = ax.twiny()
ax2.plot(MM, RR, 'none')

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


Matplotlib-users mailing list
[hidden email]