ipython notebook - Jupyter: how to make simple illustrations -
i learning use jupyter/ipython notebook electronic notebook. need simple illustrations go along calculations, e.g. arrows represent vector quantities. that's kind of illustration tikz used if in latex. having tried tikz magic extension , failed, wonder if there's more native (python) way this. don't see matplotlib right tool sort of thing (correct me if i'm wrong).
if think tikz magic indeed way go , should try work, so. thanks.
tikz (prefered solution)
if you're familiar tikz respective magic best option. use it, clone this repo .ipython/extensions
directory , load extension shown in example notebook %load_ext tikzmagic
.
tried ipython 3.1 , works fine. of course have have pdflatex available.
matplotlib
if want draw simple arrows matplotlib can used , is, of course, more pythonic tikz. simple example based on this example like
import matplotlib.pyplot plt %matplotlib inline plt.axis('off') plt.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k');
for more technical plots lots of arrows , dimensions, totally agree matplotlib not preferred.
other alternatives
there asymptote magic found here. haven't tried yet, though.
finally, use svgs either written in notebook (hints see this question, or using inkscape or similar , embed resulting svg-file via from ipython.display import svg
.
Comments
Post a Comment