我正在将a package that uses base graphics更新为one that uses ggplot2 graphics。在基本图形版本中,用户可以为jj提供一个值,然后该值将被缩放并传递给jitter()函数。抖动x值的代码如下所示:
degree.of.jitter <- (jj/200) * diff(x.values.range)
jitter(x.values, amount = degree.of.jitter)我希望ggplot2版本能达到与基础图形版本相同的视觉抖动效果。但是,我不确定如何重新缩放我现有的degree.of.jitter,以便我可以直接将其传递给position_jitter(),并获得相同的视觉效果:
position_jitter(width = MysteriousScalingFunctionOfCompleteMysteryWhoseInnerWorkingsIHaveYetToSpecify(jj))有没有人对jj的适当扩展有什么建议?
发布于 2011-08-18 02:53:31
在幕后,width作为amount参数传递给jitter,因此您应该能够使用
position_jitter(width = degree.of.jitter)其中degree.of.jitter的定义方式与之前相同。
https://stackoverflow.com/questions/7097695
复制相似问题