R 在hexbinplot中反转x轴

R 在hexbinplot中反转x轴,r,graphics,R,Graphics,是否可以反转hexbinplot的x轴 hexbinplot(y~x, xbins=30,xlim = rev(range(x))) 选项xlim=rev(range(x))不起作用。我不知道如何使用hexbin::hexbinplot,但是使用ggplot2,使用geom\u hex和scale\u x\u reverse非常简单 dd <- data.frame(x=rnorm(1000),y=rnorm(1000)) ggplot(dd,aes(x,y))+geom_hex()

是否可以反转hexbinplot的x轴

hexbinplot(y~x, xbins=30,xlim = rev(range(x)))

选项
xlim=rev(range(x))
不起作用。

我不知道如何使用
hexbin::hexbinplot
,但是使用
ggplot2
,使用
geom\u hex
scale\u x\u reverse
非常简单

 dd <- data.frame(x=rnorm(1000),y=rnorm(1000))
 ggplot(dd,aes(x,y))+geom_hex()+scale_x_reverse()

dd您可以通过
-1
x
叠加以反转绘图,然后使用
scales
参数反转标签

set.seed(1) 
dd <- data.frame(x=rnorm(1000),y=rnorm(1000))
y = dd$y ; xnew=-dd$x

library(hexbin)
hexbinplot(y ~ xnew, scales=list(x=list(at = pretty(xnew), 
                                        labels = rev(pretty(xnew)))))
set.seed(1)
评论中的dd“谢谢”实际上是不赞成的(尽管这种情绪是值得赞赏的);如果这些问题中有一个是您问题的好(最佳)答案,我们鼓励您单击复选标记接受它。。。