Arranging ggplot2 objects with ggplotGrob()

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Bottom posting v top posting. Was: Arranging ggplot2 objects with ggplotGrob()

Rasmus Liland-3
This email thread has some seriously
long messages in it, e.g. one is 243
lines long (i.e. 11K of plain text for
something which could have been the size
of a Post-It note), and people do not
agree if top posting or bottom posting
is, also this mime element gets attached
by GNU Mailman to each message

        ______________________________________________
        [hidden email] mailing list -- To UNSUBSCRIBE and more, see
        https://stat.ethz.ch/mailman/listinfo/r-help
        PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
        and provide commented, minimal, self-contained, reproducible code.

The result is a bit hard to read.

Most email clients support threading
these days.

Personally, like H
<[hidden email]> here, I'm a
bottom-posting-kind-of-guy, of course.

For those who care at all, here are some
useful arguments:

- https://en.wikipedia.org/wiki/Posting_style
- https://mutt-users.mutt.narkive.com/L3DegcbU/bottom-posting-v-top-posting
- https://forums.freebsd.org/threads/email-posting-style.45371/
- https://www.caliburn.nl/topposting.html
- https://www.freebsd.org/doc/en/articles/mailing-list-faq/etiquette.html
- https://www.openbsd.org/mail.html

Best,
Rasmus

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Arranging ggplot2 objects with ggplotGrob()

R help mailing list-2
In reply to this post by H-2
Then this should work:

```
library(ggplot2)
library(cowplot)

p1 <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +  
geom_point()
p2 <- ggplot(iris, aes(x = Petal.Length, y = Petal.Width * 1000)) +
geom_point()

plot_grid(p1, p2, ncol = 1, align = "hv", rel_heights = c(2, 1), axis =
"t")

p1 <- p1 + theme(
   axis.text.x = element_blank(),
   axis.title.x = element_blank(),
   axis.ticks.x = element_blank()
)

plot_grid(p1, p2, ncol = 1, align = "hv", rel_heights = c(2, 1), axis =
"t")

# You can play around with ggplot2 plot.margin to further reduce the
space
p1 <- p1 + theme(
   plot.margin = margin(b = -6)
)

p2 <- p2 + theme(
   plot.margin = margin(t = -6)
)

plot_grid(p1, p2, ncol = 1, align = "hv", rel_heights = c(2, 1), axis =
"t")
```

Best,
Ulrik

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
12