Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Facet Grid for Bar Plot with non-shared y axes (CatPlot)

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline # not for Power BI

g = sns.catplot(x="alive", col="deck", col_wrap=4,
                data=titanic[titanic.deck.notnull()],
                kind="bar", height=2.5, aspect=.8,ci=None,sharey=False)
g.set_axis_labels("Total bill ($)", "Tip ($)")
g.set_titles(col_template="{col_name} patrons", row_template="{row_name}")
plt.show()

# use col_wrap to configure the grid in case of multiple levels in col
 
PREVIOUS NEXT
Tagged: #Facet #Grid #Bar #Plot #axes
ADD COMMENT
Topic
Name
6+8 =