library(funkea)
p <-
mtcars %>%
mutate(am = if_else(am == 0, "オートマティック", "マニュアル")) %>%
ggplot(aes(hp, mpg, col = cyl)) +
theme_grey() +
geom_point() +
facet_wrap(~ am)
p +
legend_topleft()
p +
theme_funkea() +
legend_topleft() # = p + theme_bw() + inwart_tick() + transparent + jpn
gglabel
にラベルに頻用する単位をまとめる~
スタートsee_unicode()
で主要なunicodeを確認see_unicode()
qplot(1:5) + theme_bw() +
labs(x = gglabel("\u2206 Temperature", type = "degC"),
y = gglabel("PPFD", type = "muflux"),
subtitle = gglabel(~CO[2], type = "muconc"))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
str_pad
x <- c(1, 20, 100, NA)
lead_zero(x, 1)
#> [1] "1" "20" "100" NA
lead_zero(x, 2)
#> [1] "01" "20" "100" NA
lead_zero(x, 3)
#> [1] "001" "020" "100" NA
sprintf
y <- c(0.1, 0.001, 0.09, NA)
tail_zero(y, 1)
#> [1] "0.1" "0.0" "0.1" NA
tail_zero(y, 2)
#> [1] "0.10" "0.00" "0.09" NA
tail_zero(y, 3)
#> [1] "0.100" "0.001" "0.090" NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.