In [2]:
%matplotlib inline
from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np
plt.xkcd()
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
plt.xticks([])
plt.yticks([])
ax.set_ylim([-30, 10])
data = np.ones(1000)
data[700:] -= np.arange(300)
plt.annotate(
'Yup\nI did it',
xy=(700, 1), arrowprops=dict(arrowstyle='->'), xytext=(150, -10))
plt.plot(data)
plt.xlabel('y')
plt.ylabel('x')
Out[2]:
In [13]:
# Remove XKCD mode:
plt.rcdefaults()
# make a square figure and axes
plt.figure(1, figsize=(6,6))
ax = plt.axes([0.1, 0.1, 0.8, 0.8])
values = [1,2,3,4,5]
colors = ['r', 'g', 'b', 'c', 'm']
explode = [0, 0, 0.2, 0, 0]
labels = ['A', 'B', 'C', 'D', 'E']
plt.pie(values, colors= colors, labels=labels, explode = None,shadow=True)
plt.title('Title', bbox={'facecolor':'0.5', 'pad':2})
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
plt.show()
In [15]:
#Skewed uniform
uniformS = np.random.rand(10) * 10 - 4
bigOutliers = np.random.rand(10) * 5 + 10
lowOutliers = np.random.rand(10) * -5 - 10
data = np.concatenate((uniformS, bigOutliers, lowOutliers))
plt.boxplot(data)
plt.show()
In [ ]: