Is it possible to rotate a plot in R (base graphics)?

后端 未结 6 1818
灰色年华
灰色年华 2020-11-30 12:45

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

6条回答
  •  -上瘾入骨i
    2020-11-30 13:05

    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 is on CRAN and the author is Paul Murrell, the author of the grid package.

    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.

提交回复
热议问题