i'm trying to use jointplot
in a FacetGrid
in seaborn but it does not seem to be plotting the data on a grid. the code is:
import pandas
import matplotlib.pylab as plt
import seaborn as sns
plt.figure(figsize=(5, 5))
df1 = pandas.DataFrame({"x": np.random.rand(100),
"y": np.random.rand(100)})
df1["row"] = "A"
df1["col"] = "1"
df2 = pandas.DataFrame({"x": np.random.rand(100),
"y": np.random.rand(100) + 1})
df2["row"] = "A"
df2["col"] = "2"
df = pandas.concat([df1, df2])
g = sns.FacetGrid(df, row="row", col="col")
plt.figure()
# this works
#g.map(plt.scatter, "x", "y")
# this doesn't
g.map(sns.jointplot, "x", "y")
when i use g.map(plt.scatter, "x", "y")
, i get the correct result. but with g.map(sns.jointplot, "x", "y")
it only plots the second data frame and ignores the grid. is it possible to use sns.jointplot
with data aware grids?
the result i get is: