我有两个值向量,两个向量都具有相同的条目数。因此,当对这些向量进行直方图处理时,相应的分布应描绘计数与值的关系。我不确定是否会误解某些内容或绘制了错误的内容,但据我所知,红色值不应位于所有绿色值之上。当两个向量提供相同数量的条目时,当另一个在某处较高时,一个分布必须低于另一个。还是不?
plot命令:
number_ticks<- function(n) {function(limits) pretty(limits, n)}
ggplot(data, aes(x = value, fill = Parameter)) +
geom_histogram(
binwidth = 0.25,
color = "black",
alpha = 0.75) +
theme_classic() +
theme(legend.position = c(0.21, 0.85)) +
labs(title = "",
x = TeX("$ \\Delta U_{bias} / V"))) +
scale_x_continous(breaks = number_ticks(20)) +
guides(fill=guide_legend(title=Parameter))
答案 0 :(得分:2)
目前,红色直方图位于绿色直方图之上:它们已堆叠在一起。也就是说,enum FontWeightMapping {
LIGHT = 300,
NORMAL = 400,
MEDIUM = 500,
BOLD = 700
}
type Global = 'initial' | 'inherit' | 'unset';
type FontWeightRelativeNames = 'bolder' | 'lighter';
type FontWeightNames = 'light' | 'normal' | 'medium' | 'bold';
type FontWeight = number | FontWeightRelativeNames | FontWeightNames | Global;
// Then you can do something like this:
let fontWeight: FontWeight;
fontWeight = 100;
fontWeight = FontWeightMapping.LIGHT;
fontWeight = 'light';
是position = "stack"
中的默认选项,而您想使用geom_histogram
。
例如,比较
position = "identity"
使用
ggplot(diamonds, aes(price, fill = cut)) +
geom_histogram(binwidth = 500)