我有两组数据(3列:x =类别,y =数值,l =位置),我想创建一个条形图,在x轴上带有类别,对于类别的每个值,使用两个垂直条形,颜色不同,每个位置的y值。默认情况下,Excel / OpenOffice会生成这种图表。
我试过了
qplot (x,y,data=mydata,col=location, geom="histogram")
Run Code Online (Sandbox Code Playgroud)
但它会产生堆叠的条,而不是并排。然后,我查看了ggplot2文档,但没有找到我可以使用的任何其他geom(请参阅下面的完整列表)。
ggplot2无法做到这一点吗?
提前致谢。
Name Description
abline - Line, speci?ed by slope and intercept
area - Area plots
bar - Bars, rectangles with bases on y-axis
blank - Blank, draws nothing
boxplot - Box-and-whisker plot
contour - Display contours of a 3d surface in 2d
crossbar - Hollow bar with middle indicated by horizontal line
density - Display a smooth density estimate
density_2d - Contours from a 2d density estimate
errorbar …Run Code Online (Sandbox Code Playgroud)