Hi Paul,

This doesn't solve my problem since the whole point was to have two
separate x axes with different scales, etc.  One thing that I found that
does help is to use the suptitle() method of figure.  This at least puts
the title at the top of the figure and I can then fiddle with the top
offset for the subplot to get the title to not overlap the axis label.

Jon


On Tue, 2013-01-22 at 13:02 -0800, Paul Hobson wrote:
> 
> On Tue, Jan 22, 2013 at 12:22 PM, Jonathan Slavin
> <jsla...@cfa.harvard.edu> wrote:
>         Hi,
>         
>         I'm having some trouble with using twiny and a title on the
>         plot.  The
>         title is writing over the axis label -- and even the tick
>         labels.  I've
>         tried tight_layout() but it doesn't seem to help.  I could use
>         fig.text
>         instead of title and place the title text where I want it
>         (with a bit of
>         fiddling), but it'd be nice to have a more elegant solution.
> 
> 
> Try this is a workaround:
> fig, ax1 = plt.subplots()
> ax2 = ax1.twiny()
> ax1.plot(np.random.randn(50), 'gs')
> ax2.plot(np.random.randn(50), 'bo')
> ax1.set_title('Test Title')
> ax2.xaxis.tick_bottom()
> plt.show()
>  
> Does that help?
> -paul
> 
> 

-- 
______________________________________________________________
Jonathan D. Slavin              Harvard-Smithsonian CfA
jsla...@cfa.harvard.edu         60 Garden Street, MS 83
phone: (617) 496-7981           Cambridge, MA 02138-1516
 cell: (781) 363-0035           USA
______________________________________________________________


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to