My dataframe just has columns that I want to create into violin plots but without specifying a y value.
Each column is a different datasubet showing an average rate of evolution (so really the y column should be created automatically). Almost all examples using ggplot use the car dataset where you specify the x column and y column that already exists in the dataframe.
Example of my dataframe:
Species Zone1 Zone2 Zone3 Zone4
cf 0.0045 0.040 0.054 0.089
cx 0.12 0.145 0.098 0.095
cy 0.044 0.067 0.051 0.077
I want to make violin plots where the x axis has Zone1, Zone2, Zone3, and Zone4 and the y-axis are just the evolutionary rate values.
I am able to do this using the vioplot package but I want to keep my script using tidyverse and ggplot since I like it's added features more. But I cannot figure out how to transform my data to get what I need it show.
I've tried:
ggplot(my_data, aes(x=c(Zone1, Zone2, Zone3, Zone4),
y=c(Zone1, Zone2, Zone3, Zone4)) + geom_violin()
But this has too many arguments...Not sure what to do for the y variable.