Skip to content

Instantly share code, notes, and snippets.

@erikaris
Last active November 18, 2017 04:41
Show Gist options
  • Save erikaris/6e272800ddfd8f5bf4b9390ea4fc3947 to your computer and use it in GitHub Desktop.
Save erikaris/6e272800ddfd8f5bf4b9390ea4fc3947 to your computer and use it in GitHub Desktop.
# taken from Coursera
import mpl_toolkits.axes_grid1.inset_locator as mpl_il
plt.figure()
plt.boxplot([ df['normal'], df['random'], df['gamma'] ], whis='range')
# overlay axis on top of another
# create an inset using .inset_axes()
ax2 = mpl_il.inset_axes(plt.gca(), width='60%', height='40%', loc=2) #loc 5 (center right) = loc 7 (right)
# fill the axes with a histogram
ax2.hist(df['gamma'], bins=100)
ax2.margins(x=0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment