Is there a way to assign different colors to the boundaries within each violin?
We have Likert data, and for each 'item' we would like to have a different color representation inside the violin (i.e., the boundaries you see in the figures below i.e., 2nd figure, which are different from the default 'quantiles' boundaries i.e., 1st figure).
.
Any suggestions would be appreciated!
Please see the code (steps are included on how to create the figure below)!
STEP 1:
Create fake data for visualization of likert data
pre <- c(1,1,4,1,1,2,1,1,2,2,1,3,2,1,2,2,2,3,2,4,5,2,3,3,4,4,2,2,5,3,4,3,5,3,3,4,3,2,2,2,4,2,3,2,3,4,4,3,5,1,2,5,2,3,3,5,5,3,1,3,4,2,3,4,3,3,2,3,4,5,3,3,3,4,2,2,4,3,3,5,3,3,2,2,3,3,1,4,4,2,3,4,2,2,1,2,3,3,3,2,1,2,3,3,3,2,3,4,3,4,3,1,4,2,3,2,4,3,3,4,3,3,2,3,4,3,4,3,3,3)
post <- c(1,1,1,1,1,1,1,2,2,1,1,2,2,3,2,2,2,2,2,2,3,3,2,3,1,4,1,2,3,3,5,2,4,3,4,2,3,2,3,2,3,3,3,3,3,3,4,3,5,3,1,3,2,3,3,2,2,3,3,3,4,3,3,3,3,3,3,4,3,3,3,4,3,4,3,3,2,3,3,3,3,3,1,3,3,2,2,4,5,3,3,4,3,3,2,3,3,4,3,4,1,3,4,2,3,2,4,2,3,3,3,3,4,1,3,4,3,3,3,4,3,3,3,3,3,3,3,4,4,5)
STEP 2:
Do some wrangling & labeling to set up the desired structure
Is there a way to assign different colors to the boundaries within each violin? We have Likert data, and for each 'item' we would like to have a different color representation inside the violin (i.e., the boundaries you see in the figures below i.e., 2nd figure, which are different from the default 'quantiles' boundaries i.e., 1st figure).
.
Any suggestions would be appreciated!
Please see the code (steps are included on how to create the figure below)!
STEP 1: Create fake data for visualization of likert data
STEP 2: Do some wrangling & labeling to set up the desired structure
STEP 3: Create bounds function that will define the boundaries for likert data in each violin
STEP 4: Change dataframe orientation
STEP 5: Plot the figure