Hello, I am interested in plotting two (x) axes for the same figure (one of
is just showing linearly transformed values of the other); one of them
offset from the plot if possible. For instance, I have the following code:

import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.axisartist as AA

## define data
x = np.array(range(11))
xlab = x*2
y = np.random.random(len(x))

fig = plt.figure()
## first axes which is only for drawing the axis
axsecond = AA.Subplot(fig, 1,1,1)
fig.add_subplot(axsecond)
axsecond.set_xlim([min(xlab),max(xlab)])
axsecond.set_xticks(np.linspace(min(xlab),max(xlab),5))
axsecond.axis["bottom", "top", "left", "right"].set_visible(False)
axsecond.axis["newx"] = axsecond.new_floating_axis(nth_coord=0, value=1)
axsecond.axis["newx"].set_axis_direction("top")
axsecond.set_clip_on(False)
axsecond.axis["newx"].toggle(all=True)
axsecond.axis["newx"].set_visible(True)
plt.draw()
## the main set of axes containing the data
axmain = fig.add_subplot(1,1,1)
plt.plot(x,y)


In this example I wonder

1) How to turn off the top axis of axmain so the ticks from axsecond are
visible? Something like axmain["top"].set_visible(False) (which does not
work of course).

2) If I wanted to include an offset (below the main axis), I feel like
something like the following should work but doesn't:

ax.axis["newx"] = ax.new_floating_axis(nth_coord=0, value=-0.2) ## outside
of (0,1)
ax.axis["newx"].set_axis_direction("bottom")
ax.set_clip_on(False)

Thanks in advance!
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to