Skip to content

Instantly share code, notes, and snippets.

@mpilosov
Last active February 2, 2018 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpilosov/eed1040215fec8455a2f1633db83f598 to your computer and use it in GitHub Desktop.
Save mpilosov/eed1040215fec8455a2f1633db83f598 to your computer and use it in GitHub Desktop.
Quick marginal plots with Seaborn
# 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