Last active
August 10, 2021 08:03
-
-
Save ugo-nama-kun/84623f1e11fb79bb49a19725c30195b9 to your computer and use it in GitHub Desktop.
Plot figure in the center of jupyter notebook
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
import numpy as np | |
from IPython.core.display import HTML | |
import matplotlib.pyplot as plt | |
# if you like seaborn: | |
import seaborn as sns | |
sns.set() | |
sns.set_context("talk") | |
HTML(""" | |
<style> | |
.output_png { | |
display: table-cell; | |
text-align: center; | |
vertical-align: middle; | |
} | |
</style> | |
""") | |
# plot a normal dist. | |
mu, sigma = 38, 3 # mean and standard deviation | |
s = np.random.normal(mu, sigma, 1000) | |
count, bins, ignored = plt.hist(s, 13, density=True) | |
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) * | |
np.exp( - (bins - mu)**2 / (2 * sigma**2) ), | |
linewidth=2, color='r') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you will see this:
![Screen Shot 2021-08-10 at 17 02 56](https://user-images.githubusercontent.com/1684732/128830943-8ec93728-9e15-4534-a241-a313e6b06a39.png)