Incorrect colour mapping in pie chart for “light” condition for delta pain in R 6- script effets of borg
The pie chart for the light condition uses a reduced colour palette (grayscale_colors[2:3]) while three outcome categories are present. This causes a mismatch between colours and categories and leads to an incorrect visual representation for delta pain (the pie chart shows a majority of “positive delta” and a minimal share of “no delta” for the “light” condition, while the data is mostly delta = 0 and one delta = -1 for delta pain). The same code is used for fatigue, and it displays correctly with the current data sets (majority of no delta and one positive delta). Removing [2:3] for fatigue would invert colours due to the current order of categories. Correct display is not guaranteed with a different data set and may fail.
Proposed fix: remove [2:3] after grayscale_colours for ‘light’ for delta pain (L38) in order to use the correct colour palette and ensure consistent matching between categories and colours. scriptsR/6_-_script_effects_of_borg.R
Note for future improvement: To make the script fully robust for any dataset, all outcome categories should be converted to factors with explicit levels, and the colour vector should match the factor levels. This prevents category–colour mismatches regardless of data distribution.