The example below will give you some idea where to start.
It uses twin function in axes_grid toolkit.
(also see 
http://matplotlib.sourceforge.net/examples/axes_grid/parasite_simple2.html)

You may use twinx or twiny, but you need to make both x and y axis in
sync to each other (maybe using the "xlim_changed" or "ylim_changed"
event).

To change the title position you set_position method (the coordinate
is in normalized axes coordinate). If you need more control, I
recommend to use annotate function.

Regards,

-JJ

import matplotlib.transforms as mtransforms
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost

fig = plt.figure()

ax1 = SubplotHost(fig, 1,1,1)
fig.add_subplot(ax1)

ax1.plot([41000, 42000, 43000], [10., 60, 80.])

y_max = 90

aux_trans = mtransforms.Affine2D().scale(3600., y_max) # transform
from ax2 to ax1

ax2 = ax1.twin(aux_trans)

from matplotlib.dates import DateFormatter, HourLocator
locator    = HourLocator()
ax2.xaxis.set_major_locator(locator)
formatter = DateFormatter(r'$%H^h$')
ax2.xaxis.set_major_formatter(formatter)

t = ax1.set_title("Title")
t.set_position((0.5, 1.05))

plt.show()

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to