Skip to content
Advertisement

How To Plot Multiple Histograms On Same Plot With Seaborn

With matplotlib, I can make a histogram with two datasets on one plot (one next to the other, not overlay).

JavaScript

This yields the following plot.

enter image description here

However, when I try to do this with seabron;

JavaScript

I get the following error:

JavaScript

So then I try to add some color values:

JavaScript

And I get the same error. I saw this post on how to overlay graphs, but I would like these histograms to be side by side, not overlay.

And looking at the docs it doesn’t specify how to include a list of lists as the first argument ‘a’.

How can I achieve this style of histogram using seaborn?

Advertisement

Answer

If I understand you correctly you may want to try something this:

JavaScript

Which should yield a plot like this:

enter image description here

UPDATE:

Looks like you want ‘seaborn look’ rather than seaborn plotting functionality. For this you only need to:

JavaScript

Which will produce:

enter image description here

UPDATE for seaborn v0.12+:

After seaborn v0.12 to get seaborn-styled plots you need to:

JavaScript

See seaborn docs for more information.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement