奇怪的ggplot2轴文本的理由 [英] Odd justification for ggplot2 axis text

查看:121
本文介绍了奇怪的ggplot2轴文本的理由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的轴文本对齐问题,如下图所示(您可能需要放大图像才能看到问题):

I am encountering a strange axis text alignment problem, as can be seen in the graphic below (you might need to zoom in on the image to see the problem):

你可以看,x轴文本被绘制得远低于刻度,y轴文本远离刻度左边,刻度本身遍布整个地方......可能是什么导致了这种行为,更重要的是)可以做些什么来避免这种情况?代码如下,以及大量的dput()。

As you can see, the x-axis text is drawn far below the ticks, the y-axis text is far to the left of the ticks, and the ticks themselves are all over the place... What might be causing this behavior, and (perhaps more importantly) what can be done to avoid this? Code included below, as well as massive dput().

ZP6 <- ggplot(TestData,
 aes(x = Mean, y = Value))
ZP6 <- ZP6 + geom_point()
ZP6 <- ZP6 + geom_errorbarh(aes(x = Mean, xmin = Mean - ZMult * SE,
 xmax = Mean + ZMult* SE, height = 0), size = I(1/3))
ZP6 <- ZP6 + facet_grid(Category ~ Year, scales = "free", space = "free")
ZP6 <- ZP6 + scale_x_continuous("Principal Evaluative Dimension", breaks = c(-1, 0, 1)/2)
ZP6 <- ZP6 + scale_y_discrete(name = "")
ZP6 <- ZP6 + opts(title = "Mean Ideology by Characteristic")
print(ZP6)

$ b TestData的
$ b

dput()可以找到

dput() of TestData can be found here.


推荐答案

正如我在上面的评论中提到的,这种行为是 bug

As I mentioned in my comment above, this behavior is a bug in version 0.8.9 that has been fixed in the new version (0.9.0).

这篇关于奇怪的ggplot2轴文本的理由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆