Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Luigi Marongiu
Thank you! On Wed, Oct 13, 2021 at 12:00 PM Deepayan Sarkar wrote: > > On Wed, Oct 13, 2021 at 12:13 PM Luigi Marongiu > wrote: > > > > I have seen that the only package that easily rotate the plot is > > ggplot, so I ran: > > ``` > > library(ggplot2) > > df = data.frame(MR = c(negative_mr,

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Deepayan Sarkar
On Wed, Oct 13, 2021 at 12:13 PM Luigi Marongiu wrote: > > I have seen that the only package that easily rotate the plot is > ggplot, so I ran: > ``` > library(ggplot2) > df = data.frame(MR = c(negative_mr, uncertain_mr, positive_mr), > FCN = c(negative_fcn, uncertain_fcn, positive_fcn)) > p <-

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Luigi Marongiu
I have seen that the only package that easily rotate the plot is ggplot, so I ran: ``` library(ggplot2) df = data.frame(MR = c(negative_mr, uncertain_mr, positive_mr), FCN = c(negative_fcn, uncertain_fcn, positive_fcn)) p <- ggplot(df, aes(x=MR)) + geom_density() p + coord_flip() ``` Even in this

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Paul Murrell
Hi I don't think you need (or want) the 'gridGraphics' package for this. You just need to flip the x-/y-data that you get from density() (and make sure that you align the y-axes of the two plots). The following code shows an example (and adds a bit of par() control to eliminate white space).

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Bert Gunter
I don't know the gridGraphics package, and I haven't looked closely at what you are trying to do. But note that lattice functions construct grid "grobs" that can be saved and plotted in arbitrary, including rotated, viewports, using the print.trellis function. I frankly am pretty ignorant about

[R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Luigi Marongiu
Hello, I would like to show a density plot of the Y axis. To do that, I would like to split the plot into a panel 2/3 long and a density plot 1/3 long. The problem is that, since the density is on the Y axis, the density plot should be rotated byb90 degrees. I tried with the package gridGraphics