UQRUG 64
meeting
Overview: tinyplot
Questions: xlsx, publishing, pdf, GAM, genAI, date as quarter
Questions: xlsx, publishing, pdf, GAM, genAI, date as quarter
Topic: lightweight visualisations with tinyplot
- tinyplot website: https://grantmcdermott.com/tinyplot/
- Recording of the presentation: https://www.youtube.com/watch?v=xwGkYBU67PU
Script written during the presentation:
# base R is powerful
# but:
# - obscure argument names
# - arguments buried into other functions
# - needs lots of tinkering for some plots
# tinyplot is an extension to base plots
# base R plot
plot(1:10)
barplot()
hist()
#...
View(penguins)
# base R
plot(bill_len ~ flipper_len, data = penguins)
# tinyplot equivalent
library(tinyplot)
tinyplot(bill_len ~ flipper_len, data = penguins)
# can use the alias plt()
plt(bill_len ~ flipper_len, data = penguins)
# group it by species
plt(bill_len ~ flipper_len | species, data = penguins)
# ggplot2 equivalent
library(ggplot2)
ggplot(penguins,
aes(flipper_len, bill_len, colour = species)) +
geom_point()
# change the shape with pch
plt(bill_len ~ flipper_len | species,
data = penguins,
pch = 20)
# shapes?
?pch
# documentation
?plot
?tinyplot
# use any character
plt(bill_len ~ flipper_len | species,
data = penguins,
pch = c("A", "C", "😄"))
# color palettes
plt(bill_len ~ flipper_len | species,
data = penguins,
pch = 20,
palette = "Dark2")
# what palettes are available?
palette.pals()
hcl.pals()
# theming
plt(bill_len ~ flipper_len | species,
data = penguins,
pch = 20,
palette = "Dark2",
grid = TRUE, frame = FALSE)
# apply a persistent theme
tinytheme("clean2")
plt(bill_len ~ flipper_len | species,
data = penguins,
pch = 20)
# faceting
plt(bill_len ~ flipper_len | species,
data = penguins,
facet = island)
# types
plt( ~ flipper_len | species,
data = penguins,
type = "density",
fill = "by")
# histogram instead
plt( ~ flipper_len | species,
data = penguins,
type = "histogram",
fill = "by")
# does not stack the bars by default!
plt( ~ flipper_len | species,
data = penguins,
type = "histogram")
# boxplot
plt(bill_len ~ species,
data = penguins,
type = "boxplot")
# violin
plt(bill_len ~ species,
data = penguins,
type = "violin")
# linear model
plt(bill_len ~ flipper_len | species,
data = penguins,
type = "lm")
# layering
plt(bill_len ~ flipper_len | species,
data = penguins)
plt_add(type = "lm")Attendees
| Name | Where are you from? | What brings you here? |
|---|---|---|
| ? | final year PhD | tinyplot |
| Val | 1st year PhD on volcanic eruption triggers | learn R for research |
| Haileyesus | HDR student at Gatton | |
| David | RCC | |
| Angel | ||
| Harsimran | ||
| Man | School of Dentistry, 2nd year PhD | |
| Kan | ||
| Stéphane | Library | Here to help and present |