In [ ]:
from ipypublish.scripts.ipynb_latex_setup import *
Some markdown text.
A list:
A numbered list
This is a long section of text, which we only want in a document (not a presentation) some text some more text some more text some more text some more text some more text some more text some more text some more text
This is an abbreviated section of the document text, which we only want in a presentation
References to \cref{fig:example}, \cref{tbl:example}, \cref{eqn:example_sympy} and \cref{code:example_mpl}.
Referencing multiple items: \cref{fig:example,fig:example_h,fig:example_v}.
A latex citation.\cite{zelenyak_molecular_2016}
A html citation.(Kirkeminde, 2012)
\todo[inline]{an inline todo}
Some text.\todo{a todo in the margins}
In [3]:
print("""
This is some printed text,
with a nicely formatted output.
""")
In [3]:
Image('../images/example.jpg',height=400)
Out[3]:
In [4]:
images_hconcat(['../images/example.jpg',
'../images/example.jpg'],
width=600, gap=10)
Out[4]:
In [5]:
images_vconcat(['../images/example.jpg',
'../images/example.jpg'],
height=400, gap=10)
Out[5]:
In [6]:
images_gridconcat([[_,_] for _ in ['../images/example.jpg',
'../images/example.jpg']],
height=300, vgap=10,hgap=20)
Out[6]:
A matplotlib figure, with the caption set in the markdowncell above the figure.
The plotting code for a matplotlib figure (\cref{fig:example_mpl}).
In [9]:
plt.scatter(np.random.rand(10), np.random.rand(10),
label='data label')
plt.ylabel(r'a y label with latex $\alpha$')
plt.legend();
The plotting code for a pandas Dataframe table (\cref{tbl:example}).
In [8]:
df = pd.DataFrame(np.random.rand(3,4),columns=['a','b','c','d'])
df.a = ['$\delta$','x','y']
df.b = ['l','m','n']
df.set_index(['a','b'])
df.round(3)
Out[8]:
In [9]:
Latex('$$ a = b+c $$')
Out[9]:
The plotting code for a sympy equation (\cref{eqn:example_sympy}).
In [10]:
f = sym.Function('f')
y,n = sym.symbols(r'y \alpha')
f = y(n)-2*y(n-1/sym.pi)-5*y(n-2)
sym.rsolve(f,y(n),[1,4])
Out[10]:
Interactive HTML was created using ipyvolume and will render below in .html type outputs:
In [ ]:
import numpy as np
import ipyvolume.pylab as p3
p3.figure()
p3.figure()
u = np.linspace(-10, 10, 25)
x, y = np.meshgrid(u, u)
r = np.sqrt(x**2+y**2).flatten()
x = x.flatten()
y = y.flatten()
time = np.linspace(0, np.pi*2, 15)
z = np.array([(np.cos(r + t) * np.exp(-r/5)) for t in time])
color = np.array([[np.cos(r + t), 1-np.abs(z[i]), 0.1+z[i]*0] for i, t in enumerate(time)])
color = np.transpose(color, (0, 2, 1))
s = p3.scatter(x, z, y, color=color, size=(z+1), marker="sphere")
p3.ylim(-3,3)
p3.show()
p3.save('../html/embed.html')