使用ggplots(R)显示条形图而不是线

使用ggplots(R)显示条形图而不是线,r,ggplot2,histogram,R,Ggplot2,Histogram,我试图将这个直方图显示为填充条,而不是覆盖的线条。我尝试将“geom_线(alpha=.5)”更改为geom_线(alpha=.5),但没有成功 在这种情况下,显示条形图的正确方式是什么 require(reshape2) library(ggplot2) fileName <- paste("/degree_hist-104-50.csv", sep = "") mydata = read.csv(fileName,sep=",", header=TRUE, check.names=

我试图将这个直方图显示为填充条,而不是覆盖的线条。我尝试将“geom_线(alpha=.5)”更改为geom_线(alpha=.5),但没有成功

在这种情况下,显示条形图的正确方式是什么

require(reshape2)
library(ggplot2)

fileName <- paste("/degree_hist-104-50.csv", sep = "")

mydata = read.csv(fileName,sep=",", header=TRUE, check.names=FALSE)
dataM = melt(mydata,c("F"))

ggplot(data=dataM, aes(x= F, y=value, colour=variable, fill=variable)) +
geom_line(alpha=.5) +
theme_bw() +
theme(plot.background = element_blank(), panel.grid.minor = element_blank(), #panel.grid.major = element_blank(),
axis.line = element_blank(),
legend.key = element_blank(), legend.title = element_blank()) +
scale_y_continuous("Density", expand=c(0,0)) + 
scale_x_continuous("Value", expand=c(0,0)) +
theme(legend.position="bottom") +
theme(axis.title.x = element_text(vjust=-0.3, face="bold", size=12)) + 
theme(axis.title.y = element_text(vjust=1.5, face="bold", size=12)) +
theme(plot.title = element_text(lineheight=.8, face="bold"))
require(重塑2)
图书馆(GG2)

fileName
geom_-bar(alpha=.5,stat=“identity”)
?它几乎可以工作,@scoa!现在唯一的问题是它固定了条而不是覆盖条:我认为
position=“jitter”
是您想要的。或者可能是
position=“dodge”