Skip to content

Instantly share code, notes, and snippets.

@briandk
Created February 21, 2017 19:59
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 briandk/7434da6c2d703a0d7d4810a36630819e to your computer and use it in GitHub Desktop.
Save briandk/7434da6c2d703a0d7d4810a36630819e to your computer and use it in GitHub Desktop.
Dirk Colbry's solution for installing Seaborn on JupyterHub
%matplotlib inline
try:
import seaborn as sns
print('seaborn is already installed')
except:
try:
import sys
sys.path
sys.path.insert(0,'./packages')
import seaborn as sns
print('seaborn is installed in packages directory')
except:
try:
print('seaborn not found in local packages. Installing...')
!pip install -t ./packages seaborn
import seaborn as sns
except:
print('ERROR: unable to install seaborn')
sns.set(style="ticks")
# Load the example dataset for Anscombe's quartet
df = sns.load_dataset("anscombe")
# Show the results of a linear regression within each dataset
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df,
col_wrap=2, ci=None, palette="muted", size=4,
scatter_kws={"s": 50, "alpha": 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment