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

后端 未结 6 1845
灰色年华
灰色年华 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条回答
  •  时光说笑
    2020-11-30 12:57

    It's kind of possible via the gridGraphics package, although it feels a bit rough on the edges (the examples in ?grid.echo don't all work for me),

    plot(1:10, rnorm(10))
    
    library(gridGraphics)
    
    grab_grob <- function(){
      grid.echo()
      grid.grab()
    }
    
    g <- grab_grob()
    grid.newpage()
    pushViewport(viewport(width=0.7,angle=30))
    grid.draw(g)
    

提交回复
热议问题