python - How to plot non-square Seaborn jointplot or JointGrid -


i trying plot non-square data using seaborn's jointgrid hexplots. can't not plot hexbins 1:1 aspect ratio.

is there anyway override default? documentation both jointplot , jointgrid say

size : numeric, optional

size of figure (it square).

i tried going feeding extent kwarg both jointplot , jointgrid, ylim no luck.

hextraj = sns.jointplot('position_x', 'position_y', ensemble) hextraj.plot_marginals(sns.distplot, kde=false) hextraj.plot_joint(plt.hexbin, extent = boundary) hextraj.ax_joint.set_aspect('equal')  # overrides distortion hextraj.ax_joint.invert_yaxis()  # hack flip y-axis (lab convention) cax = hextraj.fig.add_axes([1, .25, .04, .5]) plt.colorbar(cax=cax) 

2d heatmap unwanted padding

stumbled upon question looking answer myself. having figured out thought i'd post solution. jointplot code seems quite insistent on having figure square don't know if considered bad practice, anyhow...

if through jointplot code , follow jointgrid, size parameter jointplot (and equally jointgrid) used in following expression:

f = plt.figure(figsize=(size, size)) # ... later on self.fig = f 

so non-square jointgrid plot, run:

grid = sns.jointplot(...) grid.fig.set_figwidth(6) grid.fig.set_figheight(4) grid.savefig("filename.png", dpi=300) 

for 6x4 figure.