You can subscribe to this list here.
2003 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}
(3) 
_{Jun}

_{Jul}

_{Aug}
(12) 
_{Sep}
(12) 
_{Oct}
(56) 
_{Nov}
(65) 
_{Dec}
(37) 

2004 
_{Jan}
(59) 
_{Feb}
(78) 
_{Mar}
(153) 
_{Apr}
(205) 
_{May}
(184) 
_{Jun}
(123) 
_{Jul}
(171) 
_{Aug}
(156) 
_{Sep}
(190) 
_{Oct}
(120) 
_{Nov}
(154) 
_{Dec}
(223) 
2005 
_{Jan}
(184) 
_{Feb}
(267) 
_{Mar}
(214) 
_{Apr}
(286) 
_{May}
(320) 
_{Jun}
(299) 
_{Jul}
(348) 
_{Aug}
(283) 
_{Sep}
(355) 
_{Oct}
(293) 
_{Nov}
(232) 
_{Dec}
(203) 
2006 
_{Jan}
(352) 
_{Feb}
(358) 
_{Mar}
(403) 
_{Apr}
(313) 
_{May}
(165) 
_{Jun}
(281) 
_{Jul}
(316) 
_{Aug}
(228) 
_{Sep}
(279) 
_{Oct}
(243) 
_{Nov}
(315) 
_{Dec}
(345) 
2007 
_{Jan}
(260) 
_{Feb}
(323) 
_{Mar}
(340) 
_{Apr}
(319) 
_{May}
(290) 
_{Jun}
(296) 
_{Jul}
(221) 
_{Aug}
(292) 
_{Sep}
(242) 
_{Oct}
(248) 
_{Nov}
(242) 
_{Dec}
(332) 
2008 
_{Jan}
(312) 
_{Feb}
(359) 
_{Mar}
(454) 
_{Apr}
(287) 
_{May}
(340) 
_{Jun}
(450) 
_{Jul}
(403) 
_{Aug}
(324) 
_{Sep}
(349) 
_{Oct}
(385) 
_{Nov}
(363) 
_{Dec}
(437) 
2009 
_{Jan}
(500) 
_{Feb}
(301) 
_{Mar}
(409) 
_{Apr}
(486) 
_{May}
(545) 
_{Jun}
(391) 
_{Jul}
(518) 
_{Aug}
(497) 
_{Sep}
(492) 
_{Oct}
(429) 
_{Nov}
(357) 
_{Dec}
(310) 
2010 
_{Jan}
(371) 
_{Feb}
(657) 
_{Mar}
(519) 
_{Apr}
(432) 
_{May}
(312) 
_{Jun}
(416) 
_{Jul}
(477) 
_{Aug}
(386) 
_{Sep}
(419) 
_{Oct}
(435) 
_{Nov}
(320) 
_{Dec}
(202) 
2011 
_{Jan}
(321) 
_{Feb}
(413) 
_{Mar}
(299) 
_{Apr}
(215) 
_{May}
(284) 
_{Jun}
(203) 
_{Jul}
(207) 
_{Aug}
(314) 
_{Sep}
(321) 
_{Oct}
(259) 
_{Nov}
(347) 
_{Dec}
(209) 
2012 
_{Jan}
(322) 
_{Feb}
(414) 
_{Mar}
(377) 
_{Apr}
(179) 
_{May}
(173) 
_{Jun}
(234) 
_{Jul}
(151) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

S  M  T  W  T  F  S 







1
(2) 
2
(4) 
3
(16) 
4
(4) 
5
(15) 
6
(16) 
7
(6) 
8
(4) 
9
(9) 
10
(5) 
11
(8) 
12
(14) 
13
(19) 
14
(21) 
15
(8) 
16
(6) 
17
(10) 
18
(22) 
19
(15) 
20
(7) 
21
(21) 
22
(1) 
23
(6) 
24
(16) 
25
(12) 
26
(11) 
27
(27) 
28
(7) 
29

30
(4) 
31
(5) 





From: Michael Rawlins <rawlins02@ya...>  20110105 22:42:17

Paul, Thanks for the detailed tutorial. I'm getting errors when I attempt to use plt.subplots(1,1) and the newcm assignment. Traceback (most recent call last): File "colorbar_Mytest2.py", line 17, in <module> f, ax = plt.subplots(1,1) AttributeError: 'module' object has no attribute 'subplots' Here are just a few of the errors I'm getting when executing colorbar command with newcm. Also, what does In and Out do, as in Out[68]: 0.34999999999999998 ? plt.draw() File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 352, in draw get_current_fig_manager().canvas.draw() File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 215, in draw FigureCanvasAgg.draw(self) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py", line 314, in draw self.figure.draw(self.renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, in draw for a in self.axes: a.draw(renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper Here's a simplified version that works for me: from matplotlib import pyplot, mpl import sys,getopt from mpl_toolkits.basemap import Basemap, shiftgrid, cm #from netCDF3 import Dataset as NetCDFFile from mpl_toolkits.basemap import NetCDFFile from pylab import * vals = norm(np.linspace(14,40,1000)) newcm = cm.colors.ListedColormap(cm.hot_r(vals)) # Make a figure and axes with dimensions as desired. fig = pyplot.figure(figsize=(8,3)) #f, ax = plt.subplots(1,1) ax1 = fig.add_axes([0.05, 0.4, 0.9, 0.14]) #ax2 = fig.add_axes([0.05, 0.8, 0.9, 0.6]) # Set the colormap and norm to correspond to the data for which # the colorbar will be used. cmap = mpl.cm.cool norm = mpl.colors.Normalize(vmin=0, vmax=40) # here set colorbar min/max mycolormap=cm.hot maprev = cm.hot_r #f,(ax2,ax3) = plt.subplots(2,1) cb2 = mpl.colorbar.ColorbarBase(ax1, cmap=cm.hot_r, norm=norm, orientation='horizontal') #cb2.set_label('"percent"') #cb3 = mpl.colorbar.ColorbarBase(ax1, cmap=newcm, # orientation='horizontal') #cb3.set_label("colormap interval 0.01.0") plt.draw() 
From: Paul Ivanov <pivanov314@gm...>  20110105 22:17:43

Neal Becker, on 20110105 08:19, wrote: > I want to plot semilogy with major and minor grid. I tried: > > plt.grid(which='both') > > But 2 problems: > > 1) For semilogy, most of my viewers will expect to see 10 minor > ticks/major tick. I got 5. How do I change it? Hi Neal, odd, it works here. (See attached image) In [1]: plt.semilogy(((np.random.rand(50)*9+1))) If your problem persists, can you provide a small example where this does not work? You might check the minor locator  make sure that it is base 10 In [2]: plt.gca().yaxis.minor.locator._base Out[2]: 10.0 > 2) I'd like the major ticks to be solid lines, and minor ticks > to be dashed. I got all dashed. In [3]: plt.grid(which='major', linestyle='solid') In [4]: plt.grid(which='minor', linestyle='dashed')  Paul Ivanov 314 address only used for lists, offlist direct email at: http://pirsquared.org  GPG/PGP key id: 0x0F3E28F7 
From: Paul Ivanov <pivanov314@gm...>  20110105 21:10:06

Michael Rawlins, on 20110105 08:44, wrote: > How does one define a range of colors for a custom userdefined > colormap? I'm fairly new to matplotlib and have been using > standard colormaps. Below is a sample program that makes a > color bar based on the hot colormap. I'd like to have a > colormap like hot, but that starts at, say, orange (near 14%), > and runs to black (40%). Hi Michael, first a quick aside: your reversing of the colormap is unnecessary  just change the colordict assignment line to be: colordict=cm.hot_r._segmentdata.copy() and get rid of the two nested for loops. Or better still, get rid of colordict altogether and just use maprev = cm.hot_r Ok, as far as your question  I'm not certain that this is what you're asking for  but if you want to construct a colormap that "stretches" the portion of your plot that goes from 14 to 40 "percent" (as labeled), to be the entire range of a colormap  use the following: All colormaps take as input a value from 0.01.0, and give you back an rgba tuple. You already have a normalization 'norm' in there which maps an arbitrary interval (040 in your case) to the 0.01.0 interval. So you like the color value at 14  let's find out what the scalar value for 14 is, once it's mapped to the 0.01.0 interval. In [68]: norm(14) Out[68]: 0.34999999999999998 So that's the value we will pass to cm.hot_r to get the color at 14. Let's verify that this is actually what's going on  I'll create a new figure and plot just one big dot on there of what should hopefully be the same color. In [69]: f, ax = plt.subplots(1,1) In [70]: plt.scatter(0,0,c=cm.hot_r(norm(14)),s=1000) # c is color, s is size Out[70]: <matplotlib.collections.CircleCollection object at 0xae9002c> Ok, that looks good. We can repeat the procedure for the 40 "percent" case In [89]: norm(40) Out[89]: 1.0 In [90]: plt.scatter(0,0,c=cm.hot_r(norm(40)),s=1000) Out[90]: <matplotlib.collections.CircleCollection object at 0xae97c4c> No surprises there (it's black). Now let's create our own segmented map. You can look at the documentation and an example: http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html but a LinearSegmentedColormap just splits deals with the rgb channels seperately, and for each color, defines transition points in the 0.01.0 interval which are refered to as 'x' in the links above, as well as the color to use before the transition point ('y0'), and the color to use after the point ('y1'). Here's a quote from the docs about this: Each row in the table for a given color is a sequence of x, y0, y1 tuples. In each sequence, x must increase monotonically from 0 to 1. For any input value z falling between x[i] and x[i+1], the output value of a given color will be linearly interpolated between y1[i] and y0[i+1]: row i: x y0 y1 / / row i+1: x y0 y1 Hence y0 in the first row and y1 in the last row are never used. Armed with this knowledge, you can now use the color from cm.hot_r(norm(14)) to get the entries for the first rows of your new map (remember that you're doing red, green, and blue seperately)  and then remap the remaining transition points (the 'x' portion of the tuple) to stretch portion of the colormap's 0.01.0 interval that you're interested in (i.e. map 0.3451.0 to 0.01.0). Now that's only if you want full control of the linear segments  there's a quick and dirty way to get what you want by specifying a ListedColormap using values taken from the colormap you're using. I'll just get a whole bunch of values from the desired interval of the colormap, map them through the colormap, and get my new colormap out. In [209]: vals = norm(np.linspace(14,40,1000)) In [210]: newcm = cm.colors.ListedColormap(cm.hot_r(vals)) Let's plot the original map (as in your email), and the new one we created. In [211]: f,(ax2,ax3) = plt.subplots(2,1) In [212]: cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cm.hot_r, .....: norm=norm, .....: orientation='horizontal') In [213]: cb2.set_label('"percent"') In [214]: In [215]: cb3 = mpl.colorbar.ColorbarBase(ax3, cmap=newcm, .....: orientation='horizontal') In [216]: cb3.set_label("colormap interval 0.01.0") In [217]: plt.draw() And to further clarify that we did the right thing, let's adjust the xlim on that original plot. In [221]: ax2.set_xlim(norm(14),norm(40)) Out[221]: (0.34999999999999998, 1.0) In [222]: plt.draw() Hope this clears things up,  Paul Ivanov 314 address only used for lists, offlist direct email at: http://pirsquared.org  GPG/PGP key id: 0x0F3E28F7 
From: Bob Lewis <bobl@tr...>  20110105 18:47:11

I'm trying to figure out how to capture arrow and function key events in matplotlib running with PyQt4. I can get ASCII characters, but not things like F1 or left arrow. This is a repeat request, but I'm not sure my earlier posting (which got no response) made it to the list, as I was not a subscriber at the time. In any case, I wanted to make sure that nobody knows how to do this before filing a feature request.  Bob Lewis 
From: Benjamin Root <ben.root@ou...>  20110105 17:47:57

On Wed, Jan 5, 2011 at 9:50 AM, Juan David M.C. <jvmolina@...> wrote: > Hello, anyone know the best way to draw networks with matplotlib, such > as gas networks. > > How plotted lines link?, straight lines or otherwise to minimize the > junction of lines. > > thanks and regards, > > Juan, There aren't a lot of easy ways to do it, although it is possible! However, NetworkX has been suggested in the past: http://networkx.lanl.gov/index.html I hope this is helpful! Ben Root 
From: Michael Rawlins <rawlins02@ya...>  20110105 16:44:23

How does one define a range of colors for a custom userdefined colormap? I'm fairly new to matplotlib and have been using standard colormaps. Below is a sample program that makes a color bar based on the hot colormap. I'd like to have a colormap like hot, but that starts at, say, orange (near 14%), and runs to black (40%). ''' Make a colorbar as a separate figure. ''' from matplotlib import pyplot, mpl import sys,getopt from mpl_toolkits.basemap import Basemap, shiftgrid, cm #from netCDF3 import Dataset as NetCDFFile from mpl_toolkits.basemap import NetCDFFile from pylab import * usemaprev=True # Make a figure and axes with dimensions as desired. fig = pyplot.figure(figsize=(8,3)) ax1 = fig.add_axes([0.05, 0.4, 0.9, 0.14]) # Set the colormap and norm to correspond to the data for which # the colorbar will be used. cmap = mpl.cm.cool norm = mpl.colors.Normalize(vmin=0, vmax=40) # here set colorbar min/max # alter a matplotlib color table, # cm.jet is very useful scheme, but reversed colors are better for drought colordict=cm.jet._segmentdata.copy() # dictionary ('blue', 'green', 'red') of nested tuples # autumn scheme is yellow to red colordict=cm.hot._segmentdata.copy() #mycolormap=cm.jet mycolormap=cm.hot for k in colordict.keys(): colordict[k]=[list(q) for q in colordict[k]] #convert nested tuples to nested list for a in colordict[k]: a[0]=1.a[0] #in inner list, change normalized value to 1  value. colordict[k].reverse() #reverse order of outer list maprev = cm.colors.LinearSegmentedColormap("maprev", colordict) #map = cm.colors.LinearSegmentedColormap("map", colordict) if usemaprev: mycolormap=maprev print "using reverse of defined colormap" #ax1 = fig.add_axes([0.05, 0.65, 0.9, 0.15]) #cax = axes([0.85, 0.1, 0.05, 0.7]) # setup colorbar axes #colorbar(format='%d') # draw colorbar # ColorbarBase derives from ScalarMappable and puts a colorbar # in a specified axes, so it has everything needed for a # standalone colorbar. There are many more kwargs, but the # following gives a basic continuous colorbar with ticks # and labels. #cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=jetrev, # norm=norm, # orientation='horizontal') cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=mycolormap, norm=norm, orientation='horizontal') cb1.set_label('percent') #pyplot.show() plt.savefig('colormap.png') 
From: John Hunter <jdh2358@gm...>  20110105 15:59:15

On Wed, Jan 5, 2011 at 9:51 AM, Benjamin Root <ben.root@...> wrote: > > > On Tue, Jan 4, 2011 at 5:49 AM, Marcin Dulak <marcin.dulak@...>wrote: > >> Hi, >> >> the formlayout part in the latest matplotlib requires python >= 2.5 >> See >> >> http://www.mailarchive.com/matplotlibusers@.../msg19219.html >> That causes troubles on very popular in RHEL 5 based distributions  >> they use an old python 2.4 still. >> > I already fixed this in my tree, haven't committed yet. Thanks, JDH 
From: Benjamin Root <ben.root@ou...>  20110105 15:52:01

On Tue, Jan 4, 2011 at 5:49 AM, Marcin Dulak <marcin.dulak@...> wrote: > Hi, > > the formlayout part in the latest matplotlib requires python >= 2.5 > See > > http://www.mailarchive.com/matplotlibusers@.../msg19219.html > That causes troubles on very popular in RHEL 5 based distributions  > they use an old python 2.4 still. > Can this be fixed for the next release? > > Best regards, > > Marcin > > Absolutely... this is definitely a bug and should be fixed for the 1.0.1rc release. I will patch it up right now. Ben Root 
From: Juan David M.C. <jvmolina@uc...>  20110105 15:51:06

Hello, anyone know the best way to draw networks with matplotlib, such as gas networks. How plotted lines link?, straight lines or otherwise to minimize the junction of lines. thanks and regards, 
From: Juan David M.C. <jdmolinac@gm...>  20110105 15:44:30

Hello, anyone know the best way to draw networks with matplotlib, such as gas networks. How plotted lines link?, straight lines or otherwise to minimize the junction of lines. thanks and regards, 
From: Neal Becker <ndbecker2@gm...>  20110105 13:20:28

I want to plot semilogy with major and minor grid. I tried: plt.grid(which='both') But 2 problems: 1) For semilogy, most of my viewers will expect to see 10 minor ticks/major tick. I got 5. How do I change it? 2) I'd like the major ticks to be solid lines, and minor ticks to be dashed. I got all dashed. 
From: Alain Pascal Frances <frances17404@it...>  20110105 13:19:35

Hi, I'm plotting two subplots using bar charts, the first one contains one dataset (one bar for each abscissa value), the second 3 dataset (3 bars for each abscissa value, each one with its own color). The legend of the multibars chart is not correct, it shows the color of the first dataset for all the bars legend. Note that it works correctly with matplotlib.pyplot.plot instead of matplotlib.pyplot.bar. Any idea to fix it? Thanks, A.Frances CODE OF MULTIBARS # # Name: multibars # Purpose: # # Author: alf # # Created: 05012011 # Copyright: (c) alf 2010 # Licence: <your licence> # #!/usr/bin/env python import matplotlib.pyplot as plt from numpy import array import random strTitle = 'Bars plot  multi data and legend' x = array(range(10)) y1 = [] y2 = [[],[],[]] for i in range(len(x)): y1.append(1.0 + random.random()) for j in range(len(y2)): y2[j].append(0.5 + random.random()) lbl_y1 = [] lbl_y1.append('bar 1') lbl_y2 = 'bar 2' lbl_type = ['red', 'green', 'blue'] colors_y2 = ([1,0,0],[0,1,0],[0,0,1]) lbls_y2 = [] for i in range(len(lbl_type)): lbls_y2.append(lbl_y2 + " " + lbl_type[i]) fig = plt.figure() ax1=fig.add_subplot(2,1,1) ax1.set_title("Single data") plt.bar(x, y1, color='purple', linewidth = 0, align='edge', width = 0.8) plt.legend(lbl_y1, loc= 0) plt.xticks(x) ax2=fig.add_subplot(2,1,2, sharex=ax1) ax2.set_title("Multi data") for i in range(len(y2)): plt.bar(x+(0.8*float(i)/len(y2)),y2[i],color = colors_y2[i], linewidth=0, align='edge', width = (0.8/len(y2))) plt.legend(lbls_y2, loc=0) plt.xticks(x) plt.subplots_adjust(left=0.05, bottom=0.1, right=0.95, top=0.95, wspace=0.1, hspace=0.15) plt.show() ############################## CODE OF MULTILINES # # Name: multilines # Purpose: # # Author: alf # # Created: 05012011 # Copyright: (c) alf 2010 # Licence: <your licence> # #!/usr/bin/env python import matplotlib.pyplot as plt from numpy import array import random strTitle = 'Lines plot  multi data and legend' x = array(range(10)) y1 = [] y2 = [[],[],[]] for i in range(len(x)): y1.append(1.0 + random.random()) for j in range(len(y2)): y2[j].append(0.5 + random.random()) lbl_y1 = [] lbl_y1.append('line 1') lbl_y2 = 'line 2' lbl_type = ['red', 'green', 'blue'] colors_y2 = ([1,0,0],[0,1,0],[0,0,1]) lbls_y2 = [] for i in range(len(lbl_type)): lbls_y2.append(lbl_y2 + " " + lbl_type[i]) fig = plt.figure() ax1=fig.add_subplot(2,1,1) ax1.set_title("Single data") plt.plot(x, y1, color='purple') plt.legend(lbl_y1, loc= 0) plt.xticks(x) ax2=fig.add_subplot(2,1,2, sharex=ax1) ax2.set_title("Multi data") for i in range(len(y2)): plt.plot(x,y2[i],color = colors_y2[i]) plt.legend(lbls_y2, loc=0) plt.xticks(x) plt.subplots_adjust(left=0.05, bottom=0.1, right=0.95, top=0.95, wspace=0.1, hspace=0.15) plt.show() ############################## 
From: Arthur Dijkstra <artdijk@xs...>  20110105 09:21:23

LS, How can it be done to create a 3D axis on an QtTabwidget with the mplwidget. I can make a 2d plot but not 3d. How can this be done ? Thanks, Arthur 
From: Benjamin Root <ben.root@ou...>  20110105 01:30:13

On Tue, Jan 4, 2011 at 6:17 PM, Paul Ivanov <pivanov314@...> wrote: > Gf B, on 20110104 12:31, wrote: > > On Mon, Jan 3, 2011 at 3:53 PM, Paul Ivanov <pivanov314@...> > wrote: > > Gf B, on 20110103 15:23, wrote: > > > > Can such a "grid of grids" be done with matplotlib? If so, could > someone > > > > show me how? > > > > > > You'll be able to group the inner grids visually by adjusting the > > > spacing. As far as getting the spines to only outline the outer > > > grid, and not the inner grid  I think you'll have to do it > > > manually by hiding the appropriate spines for the inner subplots. > > > > > > > This sort of adhoc manual tweaking is what I was hoping to avoid. > > > > What would it take to implement a "true" gridofgrids function in > > matplotlib? What I mean by this is a function that can arrange in a grid > > not only plots but also other grids. (Is this a question for the devel > > group?) > > I think the true gridofgrids functunality is already > implemented. Here's a replication of your Mathematica plots: > >  > import numpy as np > import matplotlib.pyplot as plt > import matplotlib.gridspec as gridspec > from itertools import product > > def squiggle_xy(a, b, c, d, i=np.linspace(0.0, 2*np.pi, 200)): > return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d) > > f = plt.figure(figsize=(8, 8)) > > # gridspec inside gridspec > outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0) > for i in xrange(16): > inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3, > subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0) > a, b = int(i/4)+1,i%4+1 > for j, (c, d) in enumerate(product(range(1, 4), repeat=2)): > ax = plt.Subplot(f, inner_grid[j]) > ax.plot(*squiggle_xy(a, b, c, d)) > ax.set_xticks([]) > ax.set_yticks([]) > f.add_subplot(ax) > > all_axes = f.get_axes() > > #show only the outside spines > for ax in all_axes: > for sp in ax.spines.values(): > sp.set_visible(False) > if ax.is_first_row(): > ax.spines['top'].set_visible(True) > if ax.is_last_row(): > ax.spines['bottom'].set_visible(True) > if ax.is_first_col(): > ax.spines['left'].set_visible(True) > if ax.is_last_col(): > ax.spines['right'].set_visible(True) > > plt.show() >  > > It's a matter of taste, but I think you can get away hiding all > spines, and just setting the hspace and wspace for the outer_grid > to some small value (this is what I meant by 'adjusting the > spacing'). > > I'll send a patch to the devel list shortly adding this example > with the following documentation > > A Complex Nested GridSpec using SubplotSpec > =========================================== > Here's a more sophisticated example of nested gridspect where we put > a box around outer 4x4 grid, by hiding appropriate spines in each of the > inner 3x3 grids. > > it'll be placed on the gridspec page, after this section: > > http://matplotlib.sourceforge.net/users/gridspec.html#gridspecusingsubplotspec > > best, >  > Paul Ivanov > 314 address only used for lists, offlist direct email at: > http://pirsquared.org  GPG/PGP key id: 0x0F3E28F7 > > Just to add, because it is related, another tool that gives you advanced control over your axes is the AxesGrid toolkit: http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/index.html#toolkitaxesgridindex However, gridspec should be exactly what you need for this particular problem. Ben Root 
From: Paul Ivanov <pivanov314@gm...>  20110105 00:17:57

Gf B, on 20110104 12:31, wrote: > On Mon, Jan 3, 2011 at 3:53 PM, Paul Ivanov <pivanov314@...> wrote: > Gf B, on 20110103 15:23, wrote: > > > Can such a "grid of grids" be done with matplotlib? If so, could someone > > > show me how? > > > > You'll be able to group the inner grids visually by adjusting the > > spacing. As far as getting the spines to only outline the outer > > grid, and not the inner grid  I think you'll have to do it > > manually by hiding the appropriate spines for the inner subplots. > > > > This sort of adhoc manual tweaking is what I was hoping to avoid. > > What would it take to implement a "true" gridofgrids function in > matplotlib? What I mean by this is a function that can arrange in a grid > not only plots but also other grids. (Is this a question for the devel > group?) I think the true gridofgrids functunality is already implemented. Here's a replication of your Mathematica plots:  import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from itertools import product def squiggle_xy(a, b, c, d, i=np.linspace(0.0, 2*np.pi, 200)): return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d) f = plt.figure(figsize=(8, 8)) # gridspec inside gridspec outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0) for i in xrange(16): inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0) a, b = int(i/4)+1,i%4+1 for j, (c, d) in enumerate(product(range(1, 4), repeat=2)): ax = plt.Subplot(f, inner_grid[j]) ax.plot(*squiggle_xy(a, b, c, d)) ax.set_xticks([]) ax.set_yticks([]) f.add_subplot(ax) all_axes = f.get_axes() #show only the outside spines for ax in all_axes: for sp in ax.spines.values(): sp.set_visible(False) if ax.is_first_row(): ax.spines['top'].set_visible(True) if ax.is_last_row(): ax.spines['bottom'].set_visible(True) if ax.is_first_col(): ax.spines['left'].set_visible(True) if ax.is_last_col(): ax.spines['right'].set_visible(True) plt.show()  It's a matter of taste, but I think you can get away hiding all spines, and just setting the hspace and wspace for the outer_grid to some small value (this is what I meant by 'adjusting the spacing'). I'll send a patch to the devel list shortly adding this example with the following documentation A Complex Nested GridSpec using SubplotSpec =========================================== Here's a more sophisticated example of nested gridspect where we put a box around outer 4x4 grid, by hiding appropriate spines in each of the inner 3x3 grids. it'll be placed on the gridspec page, after this section: http://matplotlib.sourceforge.net/users/gridspec.html#gridspecusingsubplotspec best,  Paul Ivanov 314 address only used for lists, offlist direct email at: http://pirsquared.org  GPG/PGP key id: 0x0F3E28F7 