Plotting in python

Before going to MCMC, I would like to implement a test code by using rejection sampling.

Since I am a little bit familiar with python, I’m choosing python(python3).

And I would like to plot the result that I draw from a distribution to see it

When it comes to plotting tools in python, matplotlib seems to be popular.

And we can plot data easily by using matplotlib with seaborn.

Preparation

pip3 install numpy
pip3 install matplotlib
pip3 install seaborn

Plotting

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

x = np.random.normal(size=100)
iris = sns.load_dataset("iris")

sns.jointplot('sepal_width', 'petal_length', data=iris)
plt.show()

Result

f:id:nakaly:20170208062943p:plain:w400

Sooooo easy!