Learn R Programming

ExpBites (version 0.1.3)

plot_exposure: Plot Exposure to Mosquito Bites by Hour for Bednet Users

Description

Creates a stacked area chart showing the hourly distribution of exposure to mosquito bites among bednet users, broken down by exposure type: outdoors, indoors (no net), indoors (under net), and prevented exposure due to bednet use. The hours are centered on midnight for better visualization.

Usage

plot_exposure(data, cPalette = c("#000000", "#E69F00", "#56B4E9", "#009E73"))

Value

A ggplot2 stacked area chart object showing the distribution of exposure types across centered hours.

Arguments

data

A dataframe resulting from the calculate_Exp function, containing columns:

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

  • Epo – exposure outdoors,

  • Epi – exposure indoors (not under a net),

  • Epn – exposure indoors under a net,

  • Epp – exposure prevented by net use.

cPalette

A character vector of color values (hex codes or color names) used to fill each exposure category. Must be of length 4 and will be applied in the following order: Prevented, Indoor (under net), Indoor (no net), Outdoor. Defaults to c("#000000", "#E69F00", "#56B4E9", "#009E73").

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_exposure(exposure_results)

Run the code above in your browser using DataLab