|
From: Gökhan S. <gok...@gm...> - 2009-03-09 16:15:26
|
Hello, I have six subplots in my canvas, and wondering how to place a common ylabel into the canvas in matplotlib? (Let say instead of having six same text on the y-axes just to replace them with one bigger text encompassing all six y-axes.) Is this available in ml or am I too blind to see this feature? Thanks, Gökhan |
|
From: Chip W. <chi...@gm...> - 2009-03-10 21:32:04
|
Does this get you close? It seems what your trying to do might be a bit ambiguous, but I understand the problem with the y-axis when there are lots of subplots. Maybe it would be better to change the y-ticker to make fewer ticks or the labels to be smaller. -Chip from matplotlib import pyplot as plt t = [0,1] y=[0,1] fig = plt.figure() plt.axes([0.1,0.1,0.8,0.8], frameon=True, axisbg='w') ax = fig.add_subplot(211) plt.setp(ax.get_yticklabels(), visible=False) plt.plot(t,y) ax = fig.add_subplot(212) plt.setp(ax.get_yticklabels(), visible=False) plt.plot(t,y) plt.show() Gökhan SEVER wrote: > Hello, > > I have six subplots in my canvas, and wondering how to place a common > ylabel into the canvas in matplotlib? (Let say instead of having six > same text on the y-axes just to replace them with one bigger text > encompassing all six y-axes.) > > Is this available in ml or am I too blind to see this feature? > > Thanks, > > Gökhan > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Jonathan T. <jon...@ut...> - 2009-03-11 00:02:00
|
I don't know if there is a betteer way to do it, but I think you can just attach a text artist to the figures canvas. Best, J. On Mon, Mar 9, 2009 at 12:15 PM, Gökhan SEVER <gok...@gm...> wrote: > Hello, > > I have six subplots in my canvas, and wondering how to place a common ylabel > into the canvas in matplotlib? (Let say instead of having six same text on > the y-axes just to replace them with one bigger text encompassing all six > y-axes.) > > Is this available in ml or am I too blind to see this feature? > > Thanks, > > Gökhan > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Gökhan S. <gok...@gm...> - 2009-03-11 00:51:25
|
I don't know how to do this in matplotlib. Can you give an example? Chip, I tried your method but didn't work for me :( So far, my best approach is use some GIMP tricks on transparent canvas. With these improvements I am finishing my first official poster. Thanks. Gökhan > On Tue, Mar 10, 2009 at 6:01 PM, Jonathan Taylor < > jon...@ut...> wrote: > >> I don't know if there is a betteer way to do it, but I think you can >> just attach a text artist to the figures canvas. >> >> Best, >> J. >> >> On Mon, Mar 9, 2009 at 12:15 PM, Gökhan SEVER <gok...@gm...> >> wrote: >> > Hello, >> > >> > I have six subplots in my canvas, and wondering how to place a common >> ylabel >> > into the canvas in matplotlib? (Let say instead of having six same text >> on >> > the y-axes just to replace them with one bigger text encompassing all >> six >> > y-axes.) >> > >> > Is this available in ml or am I too blind to see this feature? >> > >> > Thanks, >> > >> > Gökhan >> > >> > >> > >> ------------------------------------------------------------------------------ >> > Open Source Business Conference (OSBC), March 24-25, 2009, San >> Francisco, CA >> > -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> > -Strategies to boost innovation and cut costs with open source >> participation >> > -Receive a $600 discount off the registration fee with the source code: >> SFAD >> > http://p.sf.net/sfu/XcvMzF8H >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > >> > > |
|
From: Chip W. <chi...@gm...> - 2009-03-11 03:43:19
|
Gökhan SEVER wrote: > I don't know how to do this in matplotlib. Can you give an example? > > Chip, > > I tried your method but didn't work for me :( Well, I'm using matplotlib 0.98.5.2, I'm not sure if that makes a difference or not. Here's what I'm seeing: http://yfrog.com/090366p It's pretty rough, but I thought it might give you an idea or two. Like I said, I've been meaning to clean up my subplots too I just haven't had time to do it. I'd be curious to see how you do it if you get it working :) -Chip I'm pasting the source again in case I fumbled the last attempt: #!/usr/bin/env python # Make one axis that spans several subplots from matplotlib import pyplot as plt t = [0,1] y = [0,1] fig = plt.figure() plt.axes([0.1,0.1,0.8,0.8], frameon=True, axisbg='w') ax = fig.add_subplot(211) plt.setp(ax.get_yticklabels(), visible=False) plt.plot(t,y) ax = fig.add_subplot(212) plt.setp(ax.get_yticklabels(), visible=False) plt.plot(t,y) plt.show() > > So far, my best approach is use some GIMP tricks on transparent canvas. > With these improvements I am finishing my first official poster. > > Thanks. > Gökhan > > > On Tue, Mar 10, 2009 at 6:01 PM, Jonathan Taylor > <jon...@ut... <mailto:jon...@ut...>> > wrote: > > I don't know if there is a betteer way to do it, but I think you can > just attach a text artist to the figures canvas. > > Best, > J. > > On Mon, Mar 9, 2009 at 12:15 PM, Gökhan SEVER > <gok...@gm... <mailto:gok...@gm...>> wrote: > > Hello, > > > > I have six subplots in my canvas, and wondering how to place > a common ylabel > > into the canvas in matplotlib? (Let say instead of having six > same text on > > the y-axes just to replace them with one bigger text > encompassing all six > > y-axes.) > > > > Is this available in ml or am I too blind to see this feature? > > > > Thanks, > > > > Gökhan > > > > > > > ------------------------------------------------------------------------------ > > Open Source Business Conference (OSBC), March 24-25, 2009, > San Francisco, CA > > -OSBC tackles the biggest issue in open source: Open Sourcing > the Enterprise > > -Strategies to boost innovation and cut costs with open > source participation > > -Receive a $600 discount off the registration fee with the > source code: SFAD > > http://p.sf.net/sfu/XcvMzF8H > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > <mailto:Mat...@li...> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Sebastian K. <seb...@io...> - 2009-03-11 13:08:16
|
Hi Gökhan et al,
I hope the following code might help you out and show you the basic idea
of sharing the same x and y axis over several subplots. I've made a plot
with 2 x 2 subplots sharing both x and y axis and showing only the
labels at the left and the labels at the bottom.
import pylab
figprops = dict(figsize=(8., 8. / 1.618),
dpi=128) # Figure properties
adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93,
wspace=0.08,
hspace=0.1) #
Subplot properties
fig =
pylab.figure(**figprops)
# New figure
fig.subplots_adjust(**adjustprops)
# Tunes the subplot layout
ax = fig.add_subplot(2, 2, 1)
bx = fig.add_subplot(2, 2, 2, sharex=ax, sharey=ax)
cx = fig.add_subplot(2, 2, 3, sharex=ax, sharey=ax)
dx = fig.add_subplot(2, 2, 4, sharex=ax, sharey=ax)
ax.plot(X1, Y1, 'k-')
bx.plot(X2, Y2, 'k-')
cx.plot(X3, Y3, 'k-')
dx.plot(X4, Y4, 'k-')
pylab.setp(ax.get_xticklabels(), visible=False)
pylab.setp(bx.get_xticklabels(), visible=False)
pylab.setp(bx.get_yticklabels(), visible=False)
pylab.setp(dx.get_yticklabels(), visible=False)
You can make the subplots come closer by changing the /wspace/ and
/hspace/ entries in the /adjustprops/ dictionary.
Cheers,
Sebastian
Gökhan SEVER wrote:
> I don't know how to do this in matplotlib. Can you give an example?
>
> Chip,
>
> I tried your method but didn't work for me :(
>
> So far, my best approach is use some GIMP tricks on transparent
> canvas. With these improvements I am finishing my first official poster.
>
> Thanks.
> Gökhan
|
|
From: Gökhan S. <gok...@gm...> - 2009-03-12 04:32:20
|
Hello Sebastian, Not sure I could create a same-axes ylabels subplots similar to the one that is shown on the given screenshot with your code. ( http://img11.imageshack.us/img11/8793/subplots.png) Sorry haven't managed to make LateX work on my matplotlib outputs :( Thanks for your time and consideration. Gökhan On Wed, Mar 11, 2009 at 8:49 AM, Sebastian Krieger <seb...@io...>wrote: > Hi Gökhan et al, > > I hope the following code might help you out and show you the basic idea of > sharing the same x and y axis over several subplots. I've made a plot with 2 > x 2 subplots sharing both x and y axis and showing only the labels at the > left and the labels at the bottom. > > import pylab > > figprops = dict(figsize=(8., 8. / 1.618), > dpi=128) # Figure properties > adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93, wspace=0.08, > > hspace=0.1) # Subplot > properties > > fig = > pylab.figure(**figprops) # > New figure > fig.subplots_adjust(**adjustprops) > # Tunes the subplot layout > > ax = fig.add_subplot(2, 2, 1) > bx = fig.add_subplot(2, 2, 2, sharex=ax, sharey=ax) > cx = fig.add_subplot(2, 2, 3, sharex=ax, sharey=ax) > dx = fig.add_subplot(2, 2, 4, sharex=ax, sharey=ax) > > ax.plot(X1, Y1, 'k-') > bx.plot(X2, Y2, 'k-') > cx.plot(X3, Y3, 'k-') > dx.plot(X4, Y4, 'k-') > > pylab.setp(ax.get_xticklabels(), visible=False) > pylab.setp(bx.get_xticklabels(), visible=False) > pylab.setp(bx.get_yticklabels(), visible=False) > pylab.setp(dx.get_yticklabels(), visible=False) > > You can make the subplots come closer by changing the *wspace* and *hspace > * entries in the *adjustprops* dictionary. > > Cheers, > Sebastian > > > Gökhan SEVER wrote: > > I don't know how to do this in matplotlib. Can you give an example? > > Chip, > > I tried your method but didn't work for me :( > > So far, my best approach is use some GIMP tricks on transparent canvas. > With these improvements I am finishing my first official poster. > > Thanks. > Gökhan > > |
|
From: Sebastian K. <seb...@io...> - 2009-03-12 14:29:36
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I think now I got what you want. Simply put the label on the middle
subplot. If it's too big it will span accross the other plots.<br>
<blockquote><tt>import pylab</tt><br>
<br>
<tt>figprops = dict(figsize=(8., 8. / 1.618),
dpi=128) # Figure properties</tt><br>
<tt>adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93,
wspace=0.2,</tt><br>
<tt>
hspace=0.2) # Subplot
properties</tt><br>
<br>
<tt>fig =
pylab.figure(**figprops)
# New figure</tt><br>
<tt>fig.subplots_adjust(**adjustprops)
# Tunes the subplot layout</tt><br>
<br>
<tt>ax = fig.add_subplot(3, 1, 1)</tt><br>
<tt>bx = fig.add_subplot(3, 1, 2, sharex=ax, sharey=ax)</tt><br>
<tt>cx = fig.add_subplot(3, 1, 3, sharex=ax, sharey=ax)</tt><br>
<br>
<tt>pylab.setp(ax.get_xticklabels(), visible=False)</tt><br>
<tt>pylab.setp(bx.get_xticklabels(), visible=False)</tt><br>
<br>
<tt>bx.set_ylabel('This is a long label shared among more axes',
fontsize=14)</tt><br>
<tt>cx.set_xlabel('And a shared x label', fontsize=14)</tt><br>
</blockquote>
Cheers,<br>
Sebastian<br>
<br>
Gökhan SEVER wrote:
<blockquote
cite="mid:49d...@ma..."
type="cite">Hello Sebastian,<br>
<br>
Not sure I could create a same-axes ylabels subplots similar to the one
that is shown on the given screenshot with your code. (<a
moz-do-not-send="true"
href="http://img11.imageshack.us/img11/8793/subplots.png">http://img11.imageshack.us/img11/8793/subplots.png</a>)<br>
<br>
Sorry haven't managed to make LateX work on my matplotlib outputs :(<br>
<br>
Thanks for your time and consideration.<br>
<br>
Gökhan<br>
</blockquote>
</body>
</html>
|
|
From: Gökhan S. <gok...@gm...> - 2009-03-12 15:52:40
|
Voila, This was what I have been looking for exactly. Thanks for the solution. PS: I have edited the related wiki page reflecting this method, as well: http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label Gökhan On Thu, Mar 12, 2009 at 10:28 AM, Sebastian Krieger <seb...@io...>wrote: > I think now I got what you want. Simply put the label on the middle > subplot. If it's too big it will span accross the other plots. > > import pylab > > figprops = dict(figsize=(8., 8. / 1.618), > dpi=128) # Figure properties > adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93, wspace=0.2, > > hspace=0.2) # Subplot > properties > > fig = > pylab.figure(**figprops) # > New figure > fig.subplots_adjust(**adjustprops) > # Tunes the subplot layout > > ax = fig.add_subplot(3, 1, 1) > bx = fig.add_subplot(3, 1, 2, sharex=ax, sharey=ax) > cx = fig.add_subplot(3, 1, 3, sharex=ax, sharey=ax) > > pylab.setp(ax.get_xticklabels(), visible=False) > pylab.setp(bx.get_xticklabels(), visible=False) > > bx.set_ylabel('This is a long label shared among more axes', fontsize=14) > cx.set_xlabel('And a shared x label', fontsize=14) > > Cheers, > Sebastian > > Gökhan SEVER wrote: > > Hello Sebastian, > > Not sure I could create a same-axes ylabels subplots similar to the one > that is shown on the given screenshot with your code. ( > http://img11.imageshack.us/img11/8793/subplots.png) > > Sorry haven't managed to make LateX work on my matplotlib outputs :( > > Thanks for your time and consideration. > > Gökhan > > |