i'm trying to use tsplot in seaborn to plot timecourse data in a FacetGrid. i have two experiments, "A" and "B", each having time course measurements for two individuals (bob and joe) with three replicates. i want each subplot of the grid to contain a tsplot for a given experiment (where each individual gets a different color and where the confidence intervals are derived from the replicates. the data is below.
the code is:
import matplotlib.pylab as plt
import seaborn as sns
import pandas
df = pandas.read_csv("./data.txt", sep="\t")
sns.set(style="ticks", color_codes=True)
plt.figure()
g = sns.FacetGrid(df, col="t", hue="name", row="experiment")
g = g.map(sns.tsplot, time="t", value="val", unit="reps",
          condition="name")
plt.show()
it gives the error: TypeError: tsplot() takes at least 1 argument (5 given). 
how can this be properly plotted?
update:
I found that this requires map_dataframe. my new code is:
g = sns.FacetGrid(df, row="experiment")
g = g.map_dataframe(sns.tsplot, time="t", unit="reps",
                    value="val", condition="name")
this works except that it doesn't get the colors right:

how can this be corrected?
--
the data is data.txt:
t   name    reps    val experiment
0   bob 1   3.3 A
0   bob 2   4.0 A
0   bob 3   3.8 A
5   bob 1   6.0 A
5   bob 2   6.4 A
5   bob 3   6.9 A
10  bob 1   9.99    A
10  bob 2   9.1 A
10  bob 3   9.0 A
0   joe 1   2.1 A
0   joe 2   2.2 A
0   joe 3   2.5 A
5   joe 1   4.5 A
5   joe 2   4.1 A
5   joe 3   4.0 A
10  joe 1   6.8 A
10  joe 2   6.1 A
10  joe 3   6.2 A
0   bob 1   2.3 B
0   bob 2   3.0 B
0   bob 3   2.8 B
5   bob 1   5.0 B
5   bob 2   5.4 B
5   bob 3   5.9 B
10  bob 1   10.99   B
10  bob 2   10.1    B
10  bob 3   10.0    B
0   joe 1   3.1 B
0   joe 2   3.2 B
0   joe 3   3.5 B
5   joe 1   3.5 B
5   joe 2   3.1 B
5   joe 3   3.0 B
10  joe 1   7.8 B
10  joe 2   7.3 B
10  joe 3   7.2 B
                The solution is in @mwaskom's comment:
You have to specify a color palette to tsplot to override the fact that
FacetGridthinks it is plotting something in one color.g.map_dataframe(..., color="deep")should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With