This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's generate some data | |
spread = np.random.rand(50) * 100 | |
center = np.ones(25) * 50 | |
flier_high = np.random.rand(10) * 100 + 100 | |
flier_low = np.random.rand(10) * -100 | |
data = np.concatenate((spread, center, flier_high, flier_low)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1-1.5IQR Q1 median Q3 Q3+1.5IQR | |
|-----:-----| | |
o |--------| : |--------| o o | |
|-----:-----| | |
outlier <-----------> outliers | |
IQR | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig = plt.figure(figsize=(3, 3)) | |
ax= fig.add_subplot(111) | |
ax.pie(ordered, labels=days, | |
shadow=True, # put shadow for plot | |
radius=1.1, # Radius of the pie | |
autopct='%.1f', | |
wedgeprops=dict(width=0.8, # Width of the wedge | |
edgecolor='#062C30', # color of edge | |
linewidth= 2 # Thickness of edge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple pie chart | |
fig = plt.figure(figsize=(3, 3)) | |
ax= fig.add_subplot(111) | |
ax.pie(ordered, labels=days); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate data | |
mean = [0, 0] | |
cov = [[1, 1], [1, 2]] | |
x_hsit2d, y_hsit2d = np.random.multivariate_normal(mean, cov, 10000).T | |
fig = plt.figure(figsize=(12, 3)) | |
ax= fig.add_subplot(131) | |
ax.hist(x=x_hsit2d) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig = plt.figure(figsize=(5, 3)) | |
# Instead of seperating the number of rows, cols nad plot number, we can put them without seperator | |
ax= fig.add_subplot(221) | |
ax.hist([random_letter1, random_letter2], | |
color=['#39AEA9', '#F1E1A6'], # Color of face | |
edgecolor='#062C30', # Color of edge | |
orientation='vertical', # Vertical plot | |
bins=range(5), # equal-width bins | |
histtype='bar', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig = plt.figure(figsize=(3, 3)) | |
# Instead of seperating the number of rows, cols nad plot number, we can put them without seperator | |
ax= fig.add_subplot(111) | |
ax.hist(random_letter1, | |
color='#39AEA9', # Color of face | |
edgecolor='#062C30', # Color of edge | |
orientation='horizontal', # Horizontal plot | |
bins=range(5), # equal-width bins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple histogram | |
fig = plt.figure(figsize=(3, 3)) | |
# Instead of seperating the number of rows, cols nad plot number, we can put them without seperator | |
ax= fig.add_subplot(111) | |
# A simple bar plot | |
plt.hist(random_letter1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig = plt.figure(figsize=(4, 4)) | |
ax= fig.add_subplot(111) | |
im = ax.bar(x=days, | |
height=ordered, # Numeric variable | |
width=0.5, # Width of bars | |
color='#39AEA9', # Color of face | |
edgecolor='#062C30', # Color of edge | |
alpha=.9, # Make the bars transparent | |
yerr=error # Show the error along y-axis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig = plt.figure(figsize=(4, 4)) | |
# Instead of seperating the number of rows, cols nad plot number, we can put them without seperator | |
ax= fig.add_subplot(111) | |
# A simple bar plot | |
ax.bar(x=days, # Categorical variable | |
height=ordered # Numeric variable | |
) |