Advanced Notebook


In [1]:
%matplotlib inline

import numpy as np
import pandas as pd
from pandas.tools.plotting import scatter_matrix
from sklearn.datasets import load_boston
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('poster')
sns.set_style('whitegrid')
plt.rcParams['figure.figsize'] = 12, 8  # plotsize


import warnings
warnings.filterwarnings('ignore')

BQPlot

Examples here are shamelessly stolen from the amazing: https://github.com/maartenbreddels/jupytercon-2017/blob/master/jupytercon2017-widgets.ipynb


In [2]:
# mixed feelings about this import
import bqplot.pyplot as plt
import numpy as np

In [3]:
x = np.linspace(0, 2, 50)
y = x**2

In [4]:
fig = plt.figure()
scatter = plt.scatter(x, y)
plt.show()



In [5]:
fig.animation_duration = 500
scatter.y = 2 * x**.5

In [6]:
scatter.selected_style = {'stroke':'red', 'fill': 'orange'}
plt.brush_selector();

In [7]:
scatter.selected


Out[7]:
[]

In [8]:
scatter.selected = [1,2,10,40]

ipyvolume


In [9]:
import ipyvolume as ipv

In [10]:
N = 1000
x, y, z = np.random.random((3, N))

In [11]:
fig = ipv.figure()
scatter = ipv.scatter(x, y, z, marker='box')
ipv.show()



In [12]:
scatter.x = scatter.x - 0.5

In [13]:
scatter.x = x

In [14]:
scatter.color = "green"
scatter.size = 5

In [15]:
scatter.color = np.random.random((N,3))

In [16]:
scatter.size = 2

In [17]:
ex = ipv.datasets.animated_stream.fetch().data

In [18]:
ex.shape


Out[18]:
(6, 200, 1250)

In [19]:
ex[:, ::, ::4].shape


Out[19]:
(6, 200, 313)

In [20]:
ipv.figure()
ipv.style.use('dark')
quiver = ipv.quiver(*ipv.datasets.animated_stream.fetch().data[:,::,::4], size=5)
ipv.animation_control(quiver, interval=200)
ipv.show()
ipv.style.use('light')



In [ ]:
ipv.style.use('light')

In [23]:
quiver.geo = "cat"

In [21]:
N = 1000*1000
x, y, z = np.random.random((3, N)).astype('f4')

In [22]:
ipv.figure()
s = ipv.scatter(x, y, z, size=0.2)
ipv.show()



In [23]:
ipv.save("3d-example-plot.html")

In [24]:
!open 3d-example-plot.html

In [ ]: