|
From: Jonathan S. <js...@cf...> - 2013-01-22 21:10:43
|
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
> <js...@cf...> 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
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
______________________________________________________________
|