Back to Browse

ggplot2 part 2

28 views
Mar 21, 2022
53:14

Jacob Westaway continues How to make publication-quality plots using ggplot2 --CHAT-- 00:25:59 Kevin Bairos-Novak [JCU]: HATE the grey background 😂 00:26:05 Legana Fingerhut: Yessssss me too 00:26:10 Kevin Bairos-Novak [JCU]: theme_light() or theme_classic() every time 00:26:19 Legana Fingerhut: I like the theme_minimal or theme_classic or theme_bw 00:26:55 Kevin Bairos-Novak [JCU]: theme_dark2: function() {theme_dark() + theme(plot.background = element_rect(color = "black", fill = "black"), panel.background = element_rect(fill = NA), plot.title = element_text(color = "white"), axis.title = element_text(color = "white"), axis.text = element_text(color = "white"), axis.ticks = element_line(color = "white"), panel.border = element_rect(color = "white", fill = NA), legend.background = element_rect(fill = NA), legend.title = element_text(color = "white"), legend.text = element_text(color = "white"), strip.text = element_text(color = "white"), legend.key=element_blank() )} 00:27:02 Lorenzo Bertola: theme_classic and them_bw all the way 00:27:04 Kevin Bairos-Novak [JCU]: For a black background theme I made 00:27:18 Legana Fingerhut: I made a black background theme too! 😛high five Kevin! 00:27:19 Lorenzo Bertola: Grey background is for grey hearted people 00:27:36 Kevin Bairos-Novak [JCU]: @Legana nice!! The colour of my soul 00:28:37 Legana Fingerhut: Very useful as my presentations are always with a black background .. so I use the black theme to export my figures to make them look pretty for presentations! 00:28:57 Legana Fingerhut: end uselessrant 00:30:43 Legana Fingerhut: DPI might be too high? 00:33:26 Maxine: Dont know what happened but my ggplot is no longer working :/ 00:33:41 Jacob Westaway: what is the error? 00:34:18 Maxine: Error in library(ggplot) : there is no package called ‘ggplot’ 00:34:27 Legana Fingerhut: Maybe try and reload it 00:34:52 Lorenzo Bertola: isn’t the package ‘ggplot2’? 00:34:53 Maxine: ok I will try 00:35:14 Kevin Bairos-Novak [JCU]: 'ggplot2 00:35:17 Kevin Bairos-Novak [JCU]: not ggplot 00:35:25 Kevin Bairos-Novak [JCU]: just missing the 2 i think on the end 00:35:44 Kevin Bairos-Novak [JCU]: Nvm haha just saw lorenzo’s comment... 00:35:52 Kevin Bairos-Novak [JCU]: Yeeep 00:36:14 Kevin Bairos-Novak [JCU]: Ive got: ggplot(aes(x = continent, y = lifeExp, fill = continent), color = "black") + geom_boxplot() + theme(axis.text.x = element_blank(), axis.ticks.x = element_blank(), axis.title.x = element_blank()) 00:36:45 Kevin Bairos-Novak [JCU]: Ah yeah, usually I pipe it haha 00:36:53 Kevin Bairos-Novak [JCU]: +theme_classic() 00:37:06 Legana Fingerhut: 😂 00:37:38 Lorenzo Bertola: Hey Jacob you forgot to change the theme to remove the grey background 00:38:02 Kevin Bairos-Novak [JCU]: Ah yeah, forgot about years… 00:38:30 Ashton Kelly: Mine was a lot more boring, but I got it 00:38:31 Lorenzo Bertola: All that grey looks like Milan’s sky in a cold winter day 00:38:39 Legana Fingerhut: Yes it is very sad 00:38:46 Maxine: yer but now my plot is blank 00:39:17 Legana Fingerhut: Paste us your code for the plot? Is everything spelled correctly? 00:39:17 Maxine: no error 00:39:54 Kevin Bairos-Novak [JCU]: You might be missing geom_boxplot()? 00:40:21 Legana Fingerhut: I thought you enjoyed appearing like you’re looking down on people, Jacob 00:41:15 Legana Fingerhut: Star Trek FTW 00:41:37 Legana Fingerhut: But the penguin dataset is most awesomeness: https://allisonhorst.github.io/palmerpenguins/ 00:44:37 Kevin Bairos-Novak [JCU]: Gotta be tatooine, no? 00:44:52 Kevin Bairos-Novak [JCU]: Oh no, tatooine is purple… 00:44:59 Kevin Bairos-Novak [JCU]: Naboo? 00:45:33 Maxine: i did it! 00:46:33 Kevin Bairos-Novak [JCU]: @Maxine Nice!!! Looks great! 00:47:00 Kevin Bairos-Novak [JCU]: I thought you were plotting mass of the planets, my bad haha… 00:48:01 Kevin Bairos-Novak [JCU]: vectorized? 00:53:40 Legana Fingerhut: I usually use “legend.position = “bottom” , to maximise the plot area but so you can also see the legend 🙂 00:56:18 Legana Fingerhut: Patchwork is a great R package to combine multiple plots on a single page. Very easy to use! https://patchwork.data-imaginist.com/ 00:59:45 Kevin Bairos-Novak [JCU]: My R has crashed for a bit, but can also re-order levels using mutate(homeworld = fct_reorder(homeworld, -total_mass)) before ggplot2 to make arranged bars 01:04:27 Lorenzo Bertola: gotta go to another meeting. Good job Jacob, nice to see everyone. Will have a flyer ready by tomorrow 5pm. Let me know by email/message any info you’d like on it. Ale is sending me an example map that might be good to add 01:05:22 Maxine: Thank you Jacob 01:07:49 Ashton Kelly: Thank you!

Download

0 formats

No download links available.

ggplot2 part 2 | NatokHD