两个条形图中的条形高度以不同的“位置"聊天时,它们的高度是多少?代表? [英] What does the height of bars in the two bar chats with different "position" represents?
问题描述
我知道在此命令行中,条形的高度代表此变量颜色"中每个组的计数:
I know in this command line the height of the bars represents the count of each group in this variable "color":
ggplot(diamonds, aes(color, fill = cut)) +
geom_bar()
但是我真的想知道这个命令行:
But I really wanna know what about this command line:
ggplot(diamonds, aes(color, fill = cut)) +
geom_bar(alpha=0.5, position = "identity")
我知道前者默认为位置堆栈",我也知道位置身份"的含义.但是我真的不知道后面的条形图的高度代表什么?
I know the former is defaulted as position "stack" and I also know the meaning of position "identity". But I really can't figure out what the height of the bars in the later one represents?
多谢了!
推荐答案
我认为理解它的最好方法是想象使用 position ='dodge'
(其中会为不同的切割放置多个小节,按颜色分隔),而是将所有剪切条彼此叠加.
I think the best way to understand it is to imagine using position='dodge'
(which places multiple bars for different cuts, separated by color) and instead layering all the cut bars on top of each other.
ggplot(diamonds, aes(color, fill = cut)) +
geom_bar(alpha=0.5, position = "dodge")
ggplot(diamonds, aes(color, fill = cut)) +
geom_bar(alpha=0.5, position = "identity")
(请注意,由于公平"裁切位于前面,因此颜色会失真.)
(Note, the colors get distorted because the 'Fair' cut is in front.)
这篇关于两个条形图中的条形高度以不同的“位置"聊天时,它们的高度是多少?代表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!