mardi 5 juillet 2016

Using a multiindex dataframe to produce a complicated seaborn pointplot


example data:

table1
   c1  c2
r1 1   3
r2 2   2
r3 3   1

table2
   c1  c2
r1 4   6
r2 5   5
r3 6   4

table3
  c1  c2
r1 7  9
r2 8  8
r3 9  7

I have munged the data into a dataframe like the following, with the rows being categories of analysis, the upper level column is the individual being analyzed, and the second level the replicates.

   table1    table2    table3
   r1 r2 r3  r1 r2 r3  r1 r2 r3
c1  1 2 3     4 5 6     7 8 9
c2  3 2 1     6 5 4     9 8 7

I want to turn this into a pointplot where the mean of each replicate is the point, the remaining values are used to create a confidence interval, and a line is drawn for each table. In other words, I want the values to pass to pointplot to be x=[table1,table2,table3], y=mean(all_r_values), hue=[c1, c2]

I am not sure how to do this, or how to reshape my table into a form suitable for this.


Aucun commentaire:

Enregistrer un commentaire