Learn R Programming

ExpBites (version 0.1.3)

plot_behaviors: Plot Human and Mosquito Behaviors by Hour

Description

Generates a dual-axis plot showing the hourly variation in human behavior (proportion of individuals indoors and under bednets) and mosquito biting behavior (biting rates indoors and outdoors). Human behavior is shown as a stacked area plot on the primary Y-axis, while mosquito biting rates are shown as lines on the secondary Y-axis. Hours are centered on midnight.

Usage

plot_behaviors(data)

Value

A ggplot2 plot object with a stacked area chart for human behavior (on the primary Y-axis) and line plots for mosquito biting rates (on the secondary Y-axis), with hours centered on midnight.

Arguments

data

A dataframe (typically the output of calculate_Exp) containing the following columns:

  • hour – hour of the day (0–23),

  • p_in – proportion of users indoors (not under a net),

  • p_net – proportion of users under a net,

  • Bi_t – indoor mosquito biting rate,

  • Bo_t – outdoor mosquito biting rate.

Examples

Run this code
# generate fake data 
df <- gen_df_human(n_individuals = 100, hours = c(0:9,17:23))
df_bites <- gen_df_mosquito() 
# calculate mean hourly exposure to bites
exposure_results <- calculate_Exp(df, df_bites)
# plot
plot_behaviors(exposure_results)

Run the code above in your browser using DataLab