【发布时间】:2011-04-09 09:31:45
【问题描述】:
我有两组数据(3 列:x=类别,y = 数值,l = 位置),我想创建一个条形图,其中 x 轴上的类别,对于类别的每个值,两个垂直条,颜色不同,每个位置的 y 值。默认情况下,Excel/OpenOffice 会生成这种图表。
我试过了
qplot (x,y,data=mydata,col=location, geom="histogram")
但它会产生堆叠条,而不是并排。然后我查看了 ggplot2 文档,没有找到我可以使用的任何其他 geom(完整列表见下文)。
ggplot2 不可能吗?
提前致谢。
Name Description
abline - Line, specified 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 - Error bars
histogram - Histogram
hline - Line, horizontal
interval - Base for all interval (range) geoms
jitter - Points, jittered to reduce overplotting
line - Connect observations, in order of x value
linerange - An interval represented by a vertical line
path - Connect observations, in original order
point - Points, as for a scatterplot
pointrange - An interval represented by a vertical line, with a point
in the middle
polygon - Polygon, a filled path
quantile - Add quantile lines from a quantile regression
ribbon - Ribbons, y range with continuous x values
rug - Marginal rug plots
segment - Single line segments
smooth - Add a smoothed condition mean
step - Connect observations by stairs
text - Textual annotations
tile - Tile plot as densely as possible, assuming that every tile is the same size
vline - Line, vertical
【问题讨论】:
-
geom 是几何对象的缩写,不是几何体。
-
我已经更正了这个问题。感谢您创建 ggplot2!