-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simple plotting script for presentation
- Loading branch information
1 parent
31930fe
commit 3f7603a
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
# Simulate normally distributed data | ||
data = np.random.normal(0, 1, 10000) | ||
|
||
# Set thresholds at 10% from the bottom and top | ||
lower_threshold = np.percentile(data, 10) | ||
upper_threshold = np.percentile(data, 90) | ||
|
||
# Create histogram without axis labels, ticks, title, or grid lines | ||
plt.figure(figsize=(10, 6)) | ||
n, bins, patches = plt.hist(data, bins=50, edgecolor="black", alpha=0.7) | ||
|
||
# Color the bottom 10% in red and top 10% in green | ||
for i in range(len(patches)): | ||
if bins[i] < lower_threshold: | ||
patches[i].set_facecolor("red") | ||
elif bins[i] > upper_threshold: | ||
patches[i].set_facecolor("green") | ||
else: | ||
patches[i].set_facecolor("blue") | ||
|
||
# Remove the axes, ticks, gridlines, and title | ||
plt.gca().set_xticks([]) | ||
plt.gca().set_yticks([]) | ||
plt.gca().spines["top"].set_visible(False) | ||
plt.gca().spines["right"].set_visible(False) | ||
# plt.gca().spines["left"].set_visible(False) | ||
# plt.gca().spines["bottom"].set_visible(False) | ||
plt.grid(False) | ||
plt.title("") | ||
|
||
# Show axes, x is "Impact", y is "Labs" | ||
plt.xlabel('"Impact"') | ||
plt.ylabel("Number of Labs") | ||
|
||
# Show the simplified plot | ||
plt.show() |