Thanks Jae-Joon for your explanations.
My second question has easily been solved after setting the label position.
However, I am still stuck snapping the axis pairs. I have two different
scaled data sources. First three data (dccnConc, dccnConAmb, and dccnConSTP
are plotted on the main host y-axis, and dccnSS, and dccnSS_Amb are plotted
on the parasite left y-axis. With twin and proper Affine2D transformation I
could not make the secondary y-axis data being shown on the figure.
The script and the data file I am using is under
http://code.google.com/p/ccnworks/source/browse/#svn/trunk
I execute the script as shown below:
./dccn_plot.py 09_03_26_11_36_15.dmtccnc.combined.raw
Any further thoughts?
On Thu, Sep 24, 2009 at 10:38 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote:
> 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()
>
--
Gökhan
------------------------------------------------------------------------------
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