Skip to content

5 Raster Plots and Percent Feeding

Joses W. Ho edited this page Aug 20, 2018 · 1 revision

Load experiment

In [1]: expt1=esp.espresso(folder=path_to_expt1)
In [2]: expt1

4 feedlogs with a total of 120 flies.
3 genotypes ['w1118;MB213B-Gal4' 'MB213B-Gal4>UAS-TrpA1' 'w1118;UAS-TrpA1'].
2 temperatures [22 29].
2 foodtypes ['100mM_Sucrose' '100mM_Sucrose_100mM_Arabinose'].

You can access all the plotting functions associated with an espresso object via the plot method.

Plotting Rasters

In [3]: expt1.plot.rasters(col='Temperature',row='Status', color_by='FoodChoice')

image of rasters

Specify the rows and columns with the row and column keywords. You can change the category used to color each raster using the color_by keyword. To plot along the rows or columns only, set the ignored axes to None.

In [4]: expt1.plot.rasters(col=None, row='Status', color_by='FoodChoice')

image of rasters in single column

Plotting percent feeding

In [5]: expt1.plot.plot.percent_feeding(group_by='Temperature',compare_by='Status')

                        percent_feeding    ci_lower    ci_upper
 Temperature Status                                            
 22          Sibling               87.5   82.270875   92.729125
             Offspring            100.0  100.000000  100.000000
 29          Sibling               92.5   88.335417   96.664583
             Offspring            100.0  100.000000  100.000000

image of percent feeding full

The plot.percent_feeding method will output a matplotlib Figure, and a pandas dataframe with the proportions and associated 95% confidence intervals.

Specify the variable used to order the panels with the group_by keyword. Use the compare_by keyword to specify which variable will be plotted on the x-axes of each panel. You can change the category used to color each raster using the color_by keyword.

By default, plot.percent_feeding will compute and display the percentage of flies feeding for the entire assay duration (6 hours, or 360 minutes).

You can change the category used on the x-axis with the group_by keyword. You can also use the start_minute and end_minute keywords to indicate the desired time slice to compute percent feeding for.

In [6]: expt1.plot.percent_feeding(group_by='Temperature',end_minute=10)

                        percent_feeding   ci_lower   ci_upper
 Temperature Status                                          
 22          Sibling               40.0  32.254033  47.745967
             Offspring             65.0  54.334635  75.665365
 29          Sibling               42.5  34.683751  50.316249
             Offspring             55.0  43.875702  66.124298

image of percent feeding slice