我有不对齐以下两部分积:对齐侧由端相关曲线与GGPLOT2
Side-by-side plots not aligned
这些图是通过以下代码制作:
require(ggplot2)
require(gridExtra)
set.seed(0)
data <- data.frame(x=rpois(30,5),y=rpois(30,11),z=rpois(300,25))
left.plot <- ggplot(data,aes(x,y))
+ geom_bin2d(binwidth=1)
margin.data <- as.data.frame(margin.table(table(data),1))
right.plot <- ggplot(margin.data, aes(x=x,y=Freq))
+ geom_bar(stat="identity")+coord_flip()
grid.arrange(left.plot, right.plot, ncol=2)
如何将左侧图中的行与右侧图中的条对齐?
我不明白,为什么在右图您的解决方案中有4级或更小,而在左边有3条只有在标记低于4 –
它看起来像我们的随机数据不同;尝试对您的机器进行调整,并确认您的左右数字对齐。让我知道如果他们不。 – Nancy
不,他们不对齐。在你的身影中看到它。左边的绘图在右边的绘图中没有数值为3的数据。看到我上面的答案。 –