Coverage for src/lcdoc/mkdocs/lp/plugs/python/pyplugs/mpl_pyplot/__init__.py: 66.67%
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
2from functools import partial lp|index.md
4from lcdoc.mkdocs.lp.plugs import python lp|index.md
5from lcdoc.mkdocs.tools import make_img lp|index.md
7config, page, Session = (python.config, python.page, python.Session) lp|index.md
10def register(fmts): lp|index.md
11 """registering us as renderer for show(<pyplot module>) within lp python"""
12 fmts['matplotlib.pyplot'] = matplotlib_pyplot lp|index.md
15def matplotlib_pyplot(plt, fn=None, clf=True, **kw): lp|index.md
16 f = partial(plt.savefig, transparent=True)
17 try:
18 return make_img(f, fn=fn, kw=Session.kw)
19 finally:
20 plt.clf() if clf else 0