From: Michael L. <mgl...@gm...> - 2007-04-24 15:21:27
|
I recently attended a fantastic workshop by John Hunter and Fernando Perez, and John pointed out that I really do want to play with the axis objects directly. In case someone googles for this later on, here's how to do it for two boxes: ax = axes([0.1, 0.3, 0.8, 0.6]) plot(rand(12)) a2 = axes([0.1, 0.1, 0.8, 0.15]) plot(rand(12)) On 3/21/07, Eric Firing <ef...@ha...> wrote: > John Hunter wrote: > > On 3/21/07, Michael Lerner <mgl...@gm...> wrote: > >> Hi, > >> > >> I want to make a figure that has three subplots. The top one should > >> be a big, mostly square thing. The bottom two should be rectangular > >> things. That is, I want it to look like this: > >> > >> XXXXX > >> XXXXX > >> XXXXX > >> XXXXX > >> > >> XXXXX > >> XXXXX > >> > >> XXXXX > >> XXXXX > >> > >> so, I'm using subplot(311), subplot(312), subplot(313). But, things > >> are getting resized so that each of the rows has the same height. > >> That really messes up the aspect ratio for my top row. > > > > The following might hrlp: > > > > ax1 = subplot(211) > > ax2 = subplot(413) > > ax3 = subplot(414) > > > > JDH > > And if you want to tweak the positions you can use, e.g., oldpos = > ax1.get_position() to find out the present position, and > ax1.set_position(newpos) to change it. The position rectangles are > [left, bottom, width, height] in relative coordinates--that is, > fractions of the figure width and height. > > If you want to control the aspect ratio of the data without changing the > position rectangle (e.g. after adjusting it as above), use > ax1.set_aspect(aspect, adjustable='datalim'). > > Eric > -- Biophysics Graduate Student Carlson Lab, University of Michigan http://www.umich.edu/~mlerner http://lernerclan.net |