From: Tommy G. <tg...@ma...> - 2008-01-24 14:13:46
|
I have a plot that is divided into four subplots. pylab.figure() pylab.subplot(221) pylab.plot(a,b,"k-") pylab.subplot(222) pylab.plot(a,b,"k-") pylab.subplot(223) pylab.plot(a,b,"k-") pylab.subplot(224) pylab.plot(a,b,"k-") I would like to add a title to the entire plot, but pylab.title() only applies to the most recent subplot. I have tried pylab.figure() pylab.subplot(111) pylab.title("Title Here") pylab.subplot(221) pylab.plot(a,b,"k-") pylab.subplot(222) pylab.plot(a,b,"k-") pylab.subplot(223) pylab.plot(a,b,"k-") pylab.subplot(224) pylab.plot(a,b,"k-") but this does not work as I do not create a plot for the subplot(111) instance. Is there some way of getting the type of title I want easily? Cheers Tommy |
From: Bernhard V. <Ber...@de...> - 2008-01-30 10:41:04
|
Hi, I was using something like this: f = pylab.figure() f.text(.4, .95, 'My Title') # coordinates are window coordinates from 0 to 1 pylab.subplot(421) ... This could be made more robust by checking the extend and location of the subplots and length of the title... Cheers! Bernhard On 1/24/08, Tommy Grav <tg...@ma...> wrote: > I have a plot that is divided into four subplots. > > pylab.figure() > pylab.subplot(221) > pylab.plot(a,b,"k-") > pylab.subplot(222) > pylab.plot(a,b,"k-") > pylab.subplot(223) > pylab.plot(a,b,"k-") > pylab.subplot(224) > pylab.plot(a,b,"k-") > > I would like to add a title to the entire plot, but pylab.title() only > applies to the most recent subplot. I have tried > > pylab.figure() > pylab.subplot(111) > pylab.title("Title Here") > pylab.subplot(221) > pylab.plot(a,b,"k-") > pylab.subplot(222) > pylab.plot(a,b,"k-") > pylab.subplot(223) > pylab.plot(a,b,"k-") > pylab.subplot(224) > pylab.plot(a,b,"k-") > > but this does not work as I do not create a plot for > the subplot(111) instance. Is there some way of getting > the type of title I want easily? > > Cheers > Tommy > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: John H. <jd...@gm...> - 2008-01-30 16:58:17
|
On Jan 30, 2008 4:41 AM, Bernhard Voigt <Ber...@de...> wrote: > Hi, > > I was using something like this: > > f = pylab.figure() > f.text(.4, .95, 'My Title') # coordinates are window coordinates from 0 to 1 > pylab.subplot(421) if you do >>> f.text(.5, .95, 'My Title', horizontalalignment='center') you will get centering for free and won't have to do the .4 hack JDH |
From: ntroutman <loc...@ya...> - 2009-03-19 17:46:26
|
The easiest solution is the "title" keyword for subplot: pylab.subplot(221, title='A Title for 221') I'm using matplotlib/pylab 0.98.3 -- NTroutman Tommy Grav wrote: > > I have a plot that is divided into four subplots. > > pylab.figure() > pylab.subplot(221) > pylab.plot(a,b,"k-") > pylab.subplot(222) > pylab.plot(a,b,"k-") > pylab.subplot(223) > pylab.plot(a,b,"k-") > pylab.subplot(224) > pylab.plot(a,b,"k-") > > I would like to add a title to the entire plot, but pylab.title() only > applies to the most recent subplot. I have tried > > pylab.figure() > pylab.subplot(111) > pylab.title("Title Here") > pylab.subplot(221) > pylab.plot(a,b,"k-") > pylab.subplot(222) > pylab.plot(a,b,"k-") > pylab.subplot(223) > pylab.plot(a,b,"k-") > pylab.subplot(224) > pylab.plot(a,b,"k-") > > but this does not work as I do not create a plot for > the subplot(111) instance. Is there some way of getting > the type of title I want easily? > > Cheers > Tommy > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/title-when-using-subplot-tp15066004p22605721.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: jcm52 <joe...@gm...> - 2009-07-06 15:53:48
|
Perhaps this is a new feature since you sent this request, but I just came across pylab.suptitle('my super title') Seems to work fairly well, but the font sizes don't appear to behave as well as I'd like. Tommy Grav wrote: > > I have a plot that is divided into four subplots. > > pylab.figure() > pylab.subplot(221) > pylab.plot(a,b,"k-") > pylab.subplot(222) > pylab.plot(a,b,"k-") > pylab.subplot(223) > pylab.plot(a,b,"k-") > pylab.subplot(224) > pylab.plot(a,b,"k-") > > I would like to add a title to the entire plot, but pylab.title() only > applies to the most recent subplot. I have tried > > pylab.figure() > pylab.subplot(111) > pylab.title("Title Here") > pylab.subplot(221) > pylab.plot(a,b,"k-") > pylab.subplot(222) > pylab.plot(a,b,"k-") > pylab.subplot(223) > pylab.plot(a,b,"k-") > pylab.subplot(224) > pylab.plot(a,b,"k-") > > but this does not work as I do not create a plot for > the subplot(111) instance. Is there some way of getting > the type of title I want easily? > > Cheers > Tommy > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/title-when-using-subplot-tp15066004p24357703.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: John H. <jd...@gm...> - 2009-07-11 13:19:45
|
On Mon, Jul 6, 2009 at 10:35 AM, jcm52<joe...@gm...> wrote: > > Perhaps this is a new feature since you sent this request, but I just came > across > > pylab.suptitle('my super title') > > Seems to work fairly well, but the font sizes don't appear to behave as well > as I'd like. Just pass in the fontsize kwarg: pylab.suptitle('my super title', fontsize=14) JDH |