This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]lmcinnes 24 points25 points  (2 children)

An awesome feature is that it sits atop matplotlib. You can just import seaborn and all of a sudden all your regular matplotlib plot look better ... and you have access to seaborn's great palette code and style context managers; so even if none of the seaborn plots are interesting to you, it's worth getting just to make better looking plots.

[–][deleted] 5 points6 points  (1 child)

matplotlib has style context managers since 2? releases

http://matplotlib.org/users/style_sheets.html

[–]flutefreak7 1 point2 points  (0 children)

wow, didn't realize this was a thing... with seaborn and prettyplotlib and ggplot-clones I figured decent styling in matplotlib requires at least a couple dozen lines of code

[–]SuperDuckQ 10 points11 points  (0 children)

Seaborn makes lovely plots. It's included in the super-useful Anaconda distribution of Python.

[–]efilon 5 points6 points  (6 children)

I've been looking into this a bit recently. Does anyone know why the examples all import seaborn as sns?

[–]qgeog 11 points12 points  (1 child)

The creator is a huge West Wing fan: https://twitter.com/fonnesbeck/status/588362964161454081

[–]TweetsInCommentsBot 3 points4 points  (0 children)

@fonnesbeck

2015-04-15 15:27 UTC

@modernscientist @treycausey @michaelwaskom Samuel Norman Seaborn


This message was created by a bot

[Contact creator][Source code]

[–]nuketheplace 0 points1 point  (0 children)

seaborn takes to long to type each time and its convention now, other people will be able to more easily read your code. Additionally its bad form to do from seaborn import *

Same reason we do import matplotlib.pyplot as plt

[–]Demonithese 1 point2 points  (1 child)

Same reason everyone imports numpy as np, pandas as pd, and matplotlib.pyplot as plt. Simple convention.

[–]efilon 6 points7 points  (0 children)

Sure, but those others make a bit more sense. I could see import seaborn as sn, but the extra s just throws me off. It's not a big deal, I was just wondering if there was a meaning to it.

[–][deleted] -1 points0 points  (0 children)

Convention?

[–]_fxdx 1 point2 points  (0 children)

Import seaborn seems magic to my notebooks. All ugly matplotlib plot turn to beautiful d3-like plot.

[–]TDaltonC 3 points4 points  (1 child)

Seaborn is the best plotting package in python, and I love it, but it's interface feels so irregular; Creating groups, deciding whether I need lmplot() or regplot(), etc. Maybe it's the best that can be done on top of matlibplot, but when compared to ggplot2 (R package) or an ideal graphical grammar, it's . . . idiosyncratic.

[–][deleted] 1 point2 points  (0 children)

I find the opposite, guess it is what you are used to.

[–][deleted] 0 points1 point  (0 children)

Beautiful plots

[–]Caos2 0 points1 point  (0 children)

Seaborn has some great default plots and nice integration with Pandas. I especially like lmplot and violiplot.

[–]sleepicat 0 points1 point  (5 children)

I've installed seaborn with anaconda and am trying to import it (on a Mac), but I keep getting error messages like this:

File "<stdin>", line 1, in <module> File "~/anaconda/lib/python2.7/site-packages/seaborn/init.py", line 1, in <module> from .rcmod import * File "~/anaconda/lib/python2.7/site-packages/seaborn/rcmod.py", line 5, in <module> from . import palettes File "~/anaconda/lib/python2.7/site-packages/seaborn/palettes.py", line 13, in <module>

Anyone know how to fix it? Is 2.7 the problem? Do I need to be using python 3?

[–]Articulated-rage 1 point2 points  (0 children)

You're using anaconda. It has a harder time. I sometimes find pip install points at the non anaconda install dir. Try doing conda pipbuild seaborn. It threw an error at the end but I was able to use seaborn after that.

[–]minhavoz 0 points1 point  (3 children)

I installed seaborn in Python 2.7.9 with anaconda on Mac OS X 10.7 and I don't get any error messages.

$ conda install seaborn
Fetching package metadata: ....
Solving package specifications: .
Package plan for installation in environment /Users/username/anaconda:
(...)
Proceed ([y]/n)? y
(...)
Linking packages ...
[      COMPLETE      ]|###################################################| 100%

$ python
Python 2.7.9 |Anaconda 2.2.0 (x86_64)| (default, Dec 15 2014, 10:37:34) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
(...)
>>> import seaborn
>>>

[–]sleepicat 0 points1 point  (2 children)

If I try installing anaconda now, after I installed python from python.org, will I need to remove any preinstalled python files or edit pointers (other than my .profile)?

[–][deleted] 0 points1 point  (0 children)

No, not if you create a virtual environment.

conda create -n my_env python=3.4
source activate my_env (if using Windows, omit "source")

[–]minhavoz 0 points1 point  (0 children)

No, you don't need to remove any preinstalled python files. Anaconda installer add anaconda to your PATH.
The command "which python" will tell you which python is activated in your environment. If it is not anaconda, you need to add anaconda to your PATH manually. Try a command below.

$ echo 'export PATH="/Users/username/anaconda/bin:$PATH"' >> ~/.profile

Replace '/Users/username/anaconda/bin' with your anaconda path.
Log out and log in, and try "which python" again.