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
import warnings
warnings.filterwarnings('ignore')
x = np.linspace(0,10,11)
x
plt.plot(x, x, '-', label = 'my x')
plt.plot(x, x-1, '--', label = 'my smaller x')
plt.legend()
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)
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')
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 = '->'))
plt.subplot(2,1,1)
plt.subplot(2,1,2)
plt.subplot(2,2,1)
plt.subplot(2,2,2)
plt.figure().subplots_adjust(hspace = 0.5, wspace = 0.5)
plt.subplot(2,1,1)
plt.subplot(2,1,2)
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,'-')
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)
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')