Skip to content

8 Contrast Plots

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

Load Data

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'].

Creating Contrast Plots

Contrast plots can be accessed via the plot.contrast class. There are five contrast plots available:

  • my_espresso.plot.contrast.feed_count_per_fly()
  • my_espresso.plot.contrast.feed_volume_per_fly()
  • my_espresso.plot.contrast.feed_duration_per_fly()
  • my_espresso.plot.contrast.feed_speed_per_fly()
  • my_espresso.plot.contrast.latency_to_feed_per_fly()

You must specify the following keywords: group_by and compare_by.

In [3]: f1, b1 = expt1.plot.contrast.feed_count_per_fly(group_by=['FoodChoice','Genotype'],
                                                        compare_by='Temperature')

contrast plot fig1

group_by is used to determine the grouping with which to compare within. In other words, Each group in this column will receive its own 'hub-and-spoke' plot.

compare_by will be used as the factor for generating and visualizing contrasts.

There is an additional keyword color_by that can be used to determine the color of individual raw datapoints. The default is Genotype.

In [4]: f2, b2 = expt1.plot.contrast.feed_count_per_fly(group_by=['FoodChoice','Genotype'],
                                                        color_by='FoodChoice',
                                                        compare_by='Temperature')

contrast plot fig2

Similar to the dabest.plot command, a matplotlib Figure and a pandas DataFrame will be produced. The latter can be accessed and provides the relevant estimation statistics.