In [1]:
# HIDDEN
from datascience import *
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')

%load_ext autoreload
%autoreload 2


/Users/ahemani/Development/data8/datascience/datascience/tables.py:17: MatplotlibDeprecationWarning: The 'warn' parameter of use() is deprecated since Matplotlib 3.1 and will be removed in 3.3.  If any parameter follows 'warn', they should be pass as keyword, not positionally.
  matplotlib.use('agg', warn=False)
/Users/ahemani/Development/data8/datascience/datascience/util.py:10: MatplotlibDeprecationWarning: The 'warn' parameter of use() is deprecated since Matplotlib 3.1 and will be removed in 3.3.  If any parameter follows 'warn', they should be pass as keyword, not positionally.
  matplotlib.use('agg', warn=False)

In [2]:
from bokeh.sampledata.autompg import autompg as df
t = Table.from_df(df)

In [3]:
t.group('yr').plot('yr')



In [4]:
t.plot('weight', ['displ', 'hp'])



In [5]:
t.with_column('big weight', t['weight'] * 1000).plot('big weight', ['hp', 'displ'])



In [6]:
t.plot('weight', ['hp', 'displ'], overlay=False)



In [7]:
t.group_bar('cyl')



In [8]:
t.group('cyl').bar('cyl')



In [9]:
t.select(['cyl', 'displ', 'hp']).group('cyl', max).bar('cyl')



In [10]:
t.group('cyl', max).bar('cyl', [1, 2, 3])



In [11]:
t.group('cyl', max).bar('cyl', [1, 2, 3], overlay=False)



In [12]:
t.group_barh('cyl')



In [13]:
t.group('cyl').barh('cyl')



In [14]:
t.select(['cyl', 'displ', 'hp']).group('cyl', max).barh('cyl')



In [15]:
t.group('cyl', max).barh('cyl', [1, 2, 3])



In [16]:
t.group('cyl', max).barh('cyl', [1, 2, 3], overlay=False)



In [17]:
t.select(['weight', 'displ', 'hp']).scatter('weight')



In [18]:
t.select(['weight', 'displ', 'hp']).scatter('weight', fit_line=True)



In [19]:
t.select(['weight', 'displ', 'hp']).scatter('weight', fit_line=True, overlay=False)



In [20]:
t.scatter('weight', 'hp')



In [21]:
t.scatter('weight', [2, 3])



In [22]:
t.with_column('big weight', t['weight'] * 1000).scatter('big weight', 'hp')



In [23]:
t.scatter('weight', ['displ', 'hp'])



In [24]:
t.scatter('weight', ['displ', 'hp'], overlay=False)



In [25]:
# Check that grouping in scatter works just like grouping in histograms and that the legends are the same format
t.scatter("weight", "hp", group="origin")



In [26]:
t.scatter("weight", "hp", colors="origin")



In [27]:
t.drop('name').scatter('weight', 'displ', sizes='hp', s=200, group='cyl')



In [28]:
t.hist('mpg')



In [29]:
f = t.hist('mpg', normed=False)



In [30]:
t.hist('mpg', overlay=False)



In [31]:
f = t.with_column('mpg2', t['mpg'] * 10000).hist('mpg2')



In [32]:
f = t.with_column('mpg2', t['mpg'] * 10000).hist('mpg2', bins=100)



In [33]:
t.hist(['displ', 'hp'])



In [34]:
t.hist(['displ', 'hp'], overlay=False)



In [35]:
bins = np.append(np.arange(0, 200, 20), np.arange(200, 501, 50))
t.hist('displ', bins=bins, unit='cc')



In [36]:
t.with_column('displ-µm3', t['displ'] * 10000).hist('displ-µm3', bins=bins*10000, unit='µm3')