A space for playing with the notebook

Plots


In [1]:
## Basic imports (example)
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from sloth.test.dummy_data import dummy_gauss_curve

fig, axs = plt.subplots(num='test', nrows=1, ncols=2)
x1, y1 = dummy_gauss_curve()
x2, y2 = dummy_gauss_curve(xsigma=5, noise=0.1)
axs[0].plot(x1, y1, label='g1', ls='--', color='red', lw=2)
axs[1].plot(x2, y2, label='g2', ls='-.', color='orange', lw=2)
fig.legend()


Out[1]:
<matplotlib.legend.Legend at 0x7ff47eb5d6a0>

Interactive widgets


In [3]:
import ipywidgets as widgets
widgets.Checkbox(
    value=False,
    description='Check me',
    disabled=False
)



In [ ]:

Interactive Wx


In [ ]:
import wxmplot.interactive as wi
import numpy as np
x = np.linspace(0, 20, 201)
wi.plot(x, np.sin(x))

Matplotlib plots


In [21]:
from sloth.utils.plotter import Plotter
p = Plotter(nrows=1, ncols=4, title='test', figsize=(10,3))
import numpy as np
x = np.linspace(0, 20, 201)
y = np.sin(x)
p.plot(x, y, label='sin', win=0)
p.plot(x, y*x, label='sin*x', win=1, show_legend=dict(loc='lower left'))
p.plot(x, y*x**2, label='sin*x^2', win=2, show_legend=dict(loc='upper center'))
p.plot(x, -y*x**2/10+0.5, label='-sin*x^2/10+0.5', win=2, side='right')
p.plot(x, -y*x**2/10, label='-sin*x^2/10', win=2, side='right', show_legend=dict(frameon=True, fancybox=True, loc='lower left'))
p.plot(x, y+0.5, label='sin+0.5', win=0, show_legend=dict(loc='best'))
p.subplots_adjust(top=0.87)
p.legend()



In [ ]: