I am trying to create a bar chart for 4 variables but the 4th variable is resulting in a stacked bar chart while I want the variable to create separate columns instead.
How the data looks Data
data <- data.frame(x = c(PI, PI, Gap, Gap, Noise, Noise), y = c(vehicle, vehicle, 0.05ug, 0.05ug, 0.1ug, 0.1ug), z = c(1, 1, 2, 2, 1, 2), a = c(23.46, 30.7, 21.67, 32.43, 25.84, 19.42)
My code
ggplot ( data, aes ( x = trial_type, y = value, group = group, fill = trial_type, alpha = dose)) + geom_bar(stat = "identity", color = "black", position = "dodge") + facet_grid(~group)
My output
Graph
What I need: If I am correct each of the black lines in the bar chars should actually be a separate bar but I have not been successful in separating them.
TItus McGill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.