Seaborn FacetGrid Plot with Multiple Y-Axis Ranges

Question:

How do i change the single y axis interval for every plot for Seaborn’s FacetGrid Plot? If I plot a facetGrid that contains a lot of variable y values, Seaborn uses the default min and max y values of all the data to construct the only y-axis.

import pandas as pd
import seaborn as sb
from matplotlib import pyplot as plt
df = sb.load_dataset('tips')
g = sb.FacetGrid(df, col = "time")
g.map(plt.hist, "tip")
plt.show()

Id like to see an axis for every plot, however it is not shown below on the second plot.

enter image description here

Asked By: Starbucks

||

Answers:

pass sharey=False to sb.FacetGrid:

import pandas as pd
import seaborn as sb
from matplotlib import pyplot as plt
df = sb.load_dataset('tips')
g = sb.FacetGrid(df, col = "time", sharey=False)
g.map(plt.hist, "tip")
plt.show()

enter image description here

Answered By: Max Power
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.