matplotlib-users

 [Matplotlib-users] axes_grid divider with room for axis From: Brent Pedersen - 2009-11-09 23:04:10 ```hi, i'd like to use the divider stuff in axes_grid to plot a figure with 2 axes, with xticks on the bottom axis. in the script pasted below, if i use 0.07 as the min for the y-axis, then it chops off the top of the plot. if i use 0 as the min, then it doesn't chop of the top, but it doesnt show the x-axis ticks/labels. how can i have the divider account for the room needed for the labels and ticks? i've also tried: hori = [Size.AxesX(axes[0])] vert = [Size.Scaled(0.3), Size.Scaled(0.7)] d = Divider(f, rect, hori, vert) with same problem. thanks, -brent =========================================== import matplotlib.pyplot as plt from mpl_toolkits.axes_grid import make_axes_locatable import numpy as np plt.close() f = plt.figure() rect = (0, 0.07, 1, 1) #rect = (0, 0, 1, 1) ax = f.add_axes(rect, autoscale_on=False, aspect="auto") divider = make_axes_locatable(ax) ax2 = divider.new_vertical(size="30%", pad=0.0) f.add_axes(ax2) axes = [ax, ax2] for ax in axes: ax.plot(np.sin(np.linspace(0, 10, 1600))) ax.set_xlim(0, 1600) ax.set_ylim(-1, 1) axes[1].set_xticks([]) plt.show() ```
 Re: [Matplotlib-users] axes_grid divider with room for axis From: Jae-Joon Lee - 2009-11-09 23:18:49 ```On Mon, Nov 9, 2009 at 6:03 PM, Brent Pedersen wrote: > how can i have the divider account for the room needed > for the > labels and ticks? Doing this automatically is not straight forward. So you need to manually adjust the area occupied by the axes. Note that rect is [left, bottom, width, height] in normalized figure coordinate. Try something like rect=[0., 0.1, 1., 0.8], or simply use subplot. Regards, -JJ ```
 Re: [Matplotlib-users] axes_grid divider with room for axis From: Brent Pedersen - 2009-11-09 23:28:27 ```On Mon, Nov 9, 2009 at 3:18 PM, Jae-Joon Lee wrote: > On Mon, Nov 9, 2009 at 6:03 PM, Brent Pedersen wrote: >> how can i have the divider account for the room needed >> for the >> labels and ticks? > > Doing this automatically is not straight forward. So you need to > manually adjust the area occupied by the axes. > Note that rect is [left, bottom, width, height] in normalized figure > coordinate. Try something like rect=[0., 0.1, 1., 0.8], or simply use > subplot. that does it. thanks, i forgot it was height, not ymax. -brent > > Regards, > > -JJ > ```