Last active
February 2, 2018 01:34
-
-
Save mpilosov/eed1040215fec8455a2f1633db83f598 to your computer and use it in GitHub Desktop.
Quick marginal plots with Seaborn
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
# Here we utilize scipy to draw samples from two distributions and plot the result. | |
import seaborn as sns | |
import numpy as np | |
import scipy.stats as sstats | |
x_dist = sstats.norm(loc=0, scale=2) | |
y_dist = sstats.uniform(loc=0, scale=1) | |
N = 10000 | |
x_data = x_dist.rvs(N) | |
y_data = y_dist.rvs(N) | |
sns.jointplot(x=x_data, y=y_data, kind='kde', color="grey", space=0.25, stat_func=None) | |
# fun fact: check out https://xkcd.com/color/rgb/ for a wide color palette | |
colors_xkcd = sns.xkcd_palette(colors=["blue", "red", "yellow"]) | |
sns.jointplot(x=x_data, y=y_data, kind='kde', color=colors_xkcd[2], space=0.25, stat_func=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment