r - Horizontally shift boxplot bars' position using ggplot2 -
i need shift bars in boxplot horizontally on plot (left or right). there way can adjust boxplots' x-axis position without changing x-axis?
the code using generate boxplot listed below,
plot <- ggplot(aes(y = score, x = date, fill = category), data = data_r1000) + geom_boxplot(width=0.8) + ylim(20,100) + labs(title = "us_marketor") + theme(legend.position="bottom") + theme(panel.background = element_rect(fill = "transparent",colour = na)) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) + scale_fill_hue(c=50, l=85)
the results looks this
i have tried using position = position_dodge/position_jitter none of them works. output plot multiple boxplot bars, , have removed background , grids. want shift these bars left side or right side of default position.
add coord_flip()
code:
plot <- ggplot(aes(y = score, x = date, fill = category), data = data_r1000) + geom_boxplot(width=0.8) + ylim(20,100) + labs(title = "us_marketor") + theme(legend.position="bottom") + theme(panel.background = element_rect(fill = "transparent",colour = na)) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) + scale_fill_hue(c=50, l=85) + coord_flip()
Comments
Post a Comment