insightsengineering / tern

Table, Listings, and Graphs (TLG) library for common outputs used in clinical trials
https://insightsengineering.github.io/tern/
Other
77 stars 22 forks source link

Color by group in individual_patient_plot #1223

Open legrasv opened 7 months ago

legrasv commented 7 months ago

Feature description

tern/R /individual_patient_plot.R

Dear NEST,

With how is build the function h_g_ipp, currently we cannot color by something else than patient ID. My colleague try to color by Japanese vs Rest of the world, but the lines were not grouped by patient: image

Therefore, he had to add a new parameter 'col_var' in the function h_g_ipp and add col_var in all the ggplot functions (below id_var): p <- ggplot2::ggplot( data = df, mapping = ggplot2::aes( x = .data[[xvar]], y = .data[[yvar]], group = .data[[id_var]], colour = .data[[col_var]] ) )

In the end, he got his correct plot: image

Code of Conduct

Contribution Guidelines

Security Policy