给定绘图使用ggplot2绘制生成条形图。我想用ggplotly(p)创建一个类似的水平barplot。尝试使用geom_bar()中的属性coord_flip(),但没有帮助。请帮助我,谢谢。使用ggplot2绘制水平条形图并绘制
library(plotly)
dat <- data.frame(
time = factor(c("Lunch","Dinner"), levels=c("Lunch","Dinner")),
total_bill = c(14.89, 17.23))
p <- ggplot(data=dat, aes(x=time, y=total_bill)) +
geom_bar(stat="identity")
p <- ggplotly(p)
[水平Barplot的可能的复制在ggplot2](https://stackoverflow.com/questions/10941225/horizontal-barplot-in-ggplot2) –
嘿谢谢你的回复,但这不是一个重复的,因为它涉及ggplot2和情节,使情节互动 –