是否可以在R(基础图形)中旋转绘图? [英] Is it possible to rotate a plot in R (base graphics)?

查看:130
本文介绍了是否可以在R(基础图形)中旋转绘图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此进行了搜索,发现使用{grid}可以旋转图像,并且某些绘图可以旋转旋转(例如plot(x,y)而不是plot(y,x) ).

I searched for this and found that with {grid} there are ways to rotate an image, and that for some plots you can play with their rotation (for example plot(x,y) instead of plot(y,x)).

但是,我想知道是否有一种通用的方法来旋转R中的绘图(该方法适用于基础图形中生成的任何绘图)?

However, I want to know if there is a generic method to rotate a plot in R (one that would work for ANY plot generated in base graphics) ?

推荐答案

我可以肯定地说,基本图形本身没有办法通用地做到这一点.但是,有一个gridBase包,它允许在图"中混合基本图形和网格图形.该包装的小插图中有一节介绍了如何将基本图形嵌入到网格viewports中,因此您可能会去看那里,看看是否可以在绘图周围做网格包装并使用网格进行旋转.不确定这是否可行,但据我所知,这是回答您的问题的唯一可能途径.

I'm reasonably certain that there isn't a way with base graphics itself to do this generically. There is however the gridBase package which allows one to mix base graphics and grid graphics in a 'plot'. The vignette for the package has a section on embedding base graphics in grid viewports, so you might look there to see if you can cook up a grid wrapper around your plots and use grid to do the rotation. Not sure if this is a viable route but is, as far as I know, the on only potential route to an answer to your Q.

gridBase在CRAN上,作者是网格包的作者Paul Murrell.

gridBase is on CRAN and the author is Paul Murrell, the author of the grid package.

浏览小插图后,我注意到页面上问题和局限性"部分中的项目符号之一,其中指出不可能将基本图形嵌入到"旋转的 grid视口.所以我想你很不走运.

After browsing the vignette, I note one of the bullets in the Problems and Limitations section on page, which states that it is not possible to embed base graphics into a rotated grid viewport. So I guess you are out of luck.

这篇关于是否可以在R(基础图形)中旋转绘图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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