Matplotlib cheatsheet
- plt.figure(figsize=(width,height), ...)
- plt.subplots(nrows, ncols, gridspec_kw=dict(width_ratios=[1,0.5,...], height_ratios=[1,0.5,...]), ...)
- plt.subplots_adjust(hspace={height}, wspace={width})
- linestyles: "-." is dash-dotted, ".-" is continuous line with small markers
- plt.savefig(..., bbox_inches='tight', ...)
- Keywords to shrink legends: plt.legend(...
- ncol=1
- fontsize=?
- handletextpad=0.8 pad beween the legend handle and text
- handlelength=2.0
- markerfirst=True legend marker left? (True) or right? (False) of label
- markerscale=1.0
- labelspacing=0.5 vertical space between legend entries
- columnspacing=2.0
- borderpad=0.4 fractional whitespace inside the legend border
- borderaxespad=0.5 pad between axes and legend border
...)
- mpl colormap reference
- Custom legend entries:
- leg.get_texts()[0].set_color('k')
- Reticulating spines:
- plt.gca().spines['top'].set_visible(False)
- plt.gca().spines['right'].set_visible(False)
- plt.gca().spines['bottom'].set(position=('data',1), zorder=-50)