I have a data frame which contains x-axis numeric bins and continuous y-axis data across multiple categories. Initially, I created a boxplot by making the x-axis bins \"fact
Don't make x
a factor. You need to aesthetically map a group
that is a factor determining which box the value is associated with, luckily, after melting, this is what you variable
column is:
ggplot(df.m, aes(x = x, y = value, group = variable)) +
geom_boxplot()
As x
is still numeric, you can give it whatever values you want within a specific variable
level and the boxplot will show up at that spot. Or you could transform the x
axis, etc.