import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
conda install seaborn
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /anaconda3/envs/acg

  added / updated specs:
    - seaborn


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    seaborn-0.9.0              |     pyh91ea838_1         164 KB
    ------------------------------------------------------------
                                           Total:         164 KB

The following packages will be UPDATED:

  seaborn            pkgs/main/osx-64::seaborn-0.9.0-py37_0 --> pkgs/main/noarch::seaborn-0.9.0-pyh91ea838_1



Downloading and Extracting Packages
seaborn-0.9.0        | 164 KB    | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Note: you may need to restart the kernel to use updated packages.

import warnings
warnings.filterwarnings('ignore')
x = np.linspace(0,10,11)
x
array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
plt.plot(x, x, '-', label = 'my x')
plt.plot(x, x-1, '--', label = 'my smaller x')
plt.legend()
<matplotlib.legend.Legend at 0x1a1fead5f8>
plt.plot(x, x, '-', label = 'my x')
plt.plot(x, x-1, '--', label = 'my smaller x')
plt.legend(title = 'I am legend', loc = 'lower center', frameon = False)
<matplotlib.legend.Legend at 0x1a1ff27e48>
plt.plot(x, x, '-', label = 'my x')
plt.plot(x, np.sin(x), '--', label = 'my smaller x')
plt.legend(title = 'I am legend', loc = 'upper left')
plt.text(8, 1.5, 'my favourite number', ha = 'center')
Text(8, 1.5, 'my favourite number')
plt.plot(x, x, '-', label = 'my x')
plt.plot(x, np.sin(x), '--', label = 'my smaller x')
plt.legend(title = 'I am legend', loc = 'upper left')
plt.annotate('my first annotation', xy = (8, 1), xytext = (8, 5), arrowprops = dict(arrowstyle = '->'))
Text(8, 5, 'my first annotation')
plt.subplot(2,1,1)
plt.subplot(2,1,2)
<matplotlib.axes._subplots.AxesSubplot at 0x1a2016b0f0>
plt.subplot(2,2,1)
plt.subplot(2,2,2)
<matplotlib.axes._subplots.AxesSubplot at 0x1a200b32e8>
plt.figure().subplots_adjust(hspace = 0.5, wspace = 0.5)
plt.subplot(2,1,1)
plt.subplot(2,1,2)
<matplotlib.axes._subplots.AxesSubplot at 0x1a2039da90>
fig, axes = plt.subplots(2,2, sharex = 'col', sharey = 'row')
from IPython.display import Image
Image(url = 'https://matplotlib.org/1.5.1/_images/fig_map.png')
fig, axes = plt.subplots(2,2, sharex = 'col', sharey = 'row')
axes[0,0].plot(x,x,'-')
axes[1,1].plot(x,x,'-')
[<matplotlib.lines.Line2D at 0x1a20749278>]
fig, axes = plt.subplots(2,2, sharex = 'col', sharey = 'row')
for i in range(2):
    for j in range(2):
        axes[i,j].plot(x,x,'-')
y = np.random.randn(60)
plt.hist(y)
(array([ 2.,  3.,  9.,  5.,  8., 12.,  5.,  5.,  6.,  5.]),
 array([-1.82703176, -1.45739307, -1.08775438, -0.71811569, -0.348477  ,
         0.0211617 ,  0.39080039,  0.76043908,  1.13007777,  1.49971646,
         1.86935515]),
 <a list of 10 Patch objects>)
with plt.style.context('grayscale'):
    plt.hist(y, edgecolor = 'white')
with plt.style.context('dark_background'):
    plt.hist(y, edgecolor = 'black')
with plt.style.context('seaborn'):
    plt.hist(y, edgecolor = 'black')