# Just Launched: You can now import projects and releases from Google Code onto SourceForge

We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps.

## matplotlib-users

 [Matplotlib-users] labelling super-axes? From: Yaroslav Bulatov - 2005-09-16 21:45:20 ```In the picture below I'd like to have axes labelling the x,y parameters that change when moving from one subplot to another, so it would be like having subplots contained inside of another plot axes http://web.engr.oregonstate.edu/~bulatov/subplots.png What is the easiest way of doing that in matplotlib? --=20 Yaroslav Bulatov bulatov@... Dearborn 102 Oregon State University Corvallis, OR ```
 [Matplotlib-users] Re: labelling super-axes? From: Yaroslav Bulatov - 2005-09-17 03:46:22 ```On 9/16/05, Yaroslav Bulatov wrote: > In the picture below I'd like to have axes labelling the x,y > parameters that change when moving from one subplot to another, so it > would be like having subplots contained inside of another plot axes >=20 > http://web.engr.oregonstate.edu/~bulatov/subplots.png >=20 > What is the easiest way of doing that in matplotlib? For future reference, below is one way I found to do that. It looks like http://web.engr.oregonstate.edu/~bulatov/normal_grid.png I could make this self-contained for the examples.zip if needed The only unresolved issue is how to make a large image without also make all the lines thick. IE, if I do savefig(dpi=3D400), I get a large image, but all the lines are extremely thick. --- rows =3D 5 cols =3D 5 subplots_adjust(wspace=3D0,hspace=3D0) mastera =3D axes([0.125,0.1,0.775,0.8]) axis([0,5,0,5]) ylabel('approximation order') xlabel('# of datapoints') mastera.xaxis.set_major_formatter(MyFormatter(datasizes)) mastera.yaxis.set_major_formatter(MyFormatter(orders)) xticks([0.5,1.5,2.5,3.5,4.5]) yticks([0.5,1.5,2.5,3.5,4.5]) =20 for r in range(rows): for c in range(cols): masterf.add_subplot(rows, cols, r*cols+c+1) banded_plot(vp.xs, true_means[r,c,dist_num],means[r,c,dist_num],std_devs[r,c,dist_num]*2.5) axis(dist_axis) # turn off tics gca().set_xticks([]) gca().set_yticks([]) savefig(filename, dpi=3D200) class MyFormatter(Formatter): =20 """ Use a format string to format the tick """ def __init__(self, l): self.l =3D l def __call__(self, x, pos=3D0): 'Return the format for tick val x at position pos' return str(self.l[int(x)]) >=20 >=20 > -- > Yaroslav Bulatov > bulatov@... > Dearborn 102 > Oregon State University > Corvallis, OR >=20 --=20 Yaroslav Bulatov bulatov@... Dearborn 102 Oregon State University Corvallis, OR ```
 Re: [Matplotlib-users] Re: labelling super-axes? From: John Hunter - 2005-09-27 02:25:40 ```>>>>> "Yaroslav" == Yaroslav Bulatov writes: Yaroslav> For future reference, below is one way I found to do Yaroslav> that. It looks like Yaroslav> http://web.engr.oregonstate.edu/~bulatov/normal_grid.png Yaroslav> I could make this self-contained for the examples.zip if Yaroslav> needed Yes this would be very nice; perhaps you could make a wiki entry? Yaroslav> The only unresolved issue is how to make a large image Yaroslav> without also make all the lines thick. IE, if I do Yaroslav> savefig(dpi=400), I get a large image, but all the lines Yaroslav> are extremely thick. Hmm, this should not make a difference. Eg, in the following example >>> plot([1,2,3]) >>> savefig('test100', dpi=100) >>> savefig('test600', dpi=600) The relative linewidths look comparable. JDH ```
 Re: [Matplotlib-users] Re: labelling super-axes? From: Chris Barker - 2005-09-27 16:48:54 Attachments: MPL_size_test.py ``` John Hunter wrote: >>>>>>"Yaroslav" == Yaroslav Bulatov writes: > Yaroslav> The only unresolved issue is how to make a large image > Yaroslav> without also make all the lines thick. IE, if I do > Yaroslav> savefig(dpi=400), I get a large image, but all the lines > Yaroslav> are extremely thick. > > Hmm, this should not make a difference. Eg, in the following example > > >>> plot([1,2,3]) > >>> savefig('test100', dpi=100) > >>> savefig('test600', dpi=600) > > The relative linewidths look comparable. I'm guessing the OP wanted to get an image with more pixels, but NOT have the lines be more pixels wide. I think this might help: There are three parameters define an image size (this is not MPL specific): Size in length units (inches, cm, pt, etc): i.e. 5"x7" Size in pixels: i.e. 800x600 pixels Dots per Inch (dpi) i.e. 100 dpi Only two of these are independent, so if you define two of them, the third can be calculated from the others. When displaying on a computer screen (or saved to a PNG), the size in length units is irrelevant, the pixels are simply displayed. When printed, or saved to PS, EPS or PDF (all designed to support printing), then the Size or dpi is used to determine how to scale the image. Now I'm getting into how I think MPL works, but it turns out I'm wrong here. See the example below for a test. Note, this John, please correct this! 1) The size of a figure is defined in length units (inches), and can be set by: Figure.set_figsize_inches( (w,h) ) 2b) The layout of the figure is defined in "figure units" so it can be scaled by changing the figure size. 2) Size of text, width of lines, etc is defined in terms of length units (points?). 3) When displaying to the screen, or creating an image (PNG) the pixel size of text and line widths, etc is determined by the dpi setting, which is set by: Figure.set_dpi( val ) The trick here is that when printing, it's natural to think in terms of inches, but when creating an image (for a web page, for instance), it is natural to think in terms of pixel size. However, AFAIK, MPL does not have a way to set the pixel size directly (remember that you can only set two of the three size parameters, the third must be calculated from the other two). So, in the OPs case, I think what is wanted to create a large image in terms of pixel size, but not change hoe many pixels wide a line is. In theory, you could accomplish that by using: Figure.set_figsize_inches( (w,h) ) Without changing the dpi. I've done a test case, and this works. However, what doesn't seem to have any effect is changing the dpi of the Figure. What's up John? shouldn't Figure.set_dpi effect the dpi of the resulting PNG? I'm using MPL 0.83.1 on Linux. I'll go upgrade now, so if this has been fixed, I guess you can ignore it. -Chris Enclosed is a sample script, and below are the results: using MPL version: 0.83.1 DPI: 80.0 Size in Inches (7.9749999999999996, 5.6624999999999996) Which should result in a 638 x 453 Image DPI: 160.0 Size in Inches (7.9749999999999996, 5.6624999999999996) Which should result in a 1276 x 906 Image DPI: 160.0 Size in Inches (16.0, 12.0) Which should result in a 2560 x 1920 Image DPI: 80.0 Size in Inches (16.0, 12.0) -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@... ```
 Re: [Matplotlib-users] Re: labelling super-axes? From: Chris Barker - 2005-09-27 17:41:58 ```Chris Barker wrote: > However, what doesn't seem to have any effect is changing the dpi of the > Figure. What's up John? shouldn't Figure.set_dpi effect the dpi of the > resulting PNG? I'm using MPL 0.83.1 on Linux. I'll go upgrade now, so if > this has been fixed, I guess you can ignore it. FWIW, I just upgraded to 0.84, with exactly the same results. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@... ```