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

查看:46
本文介绍了是否可以在 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天全站免登陆