label_repl2blank | R Documentation |
ggplot作図の際に軸ラベルの一部を空白にすることで minor break の ようにみせかける.
label_repl2blank(
nskip = 1,
shift = 0,
first = FALSE,
last = FALSE,
inverse = FALSE,
comma = FALSE,
ptime = FALSE,
ftime = "%Y-%m-%d"
)
nskip |
何個置きに空白文字にするか, Default: 1. |
shift |
blankで置き換える位置を右にずらす. Default: 0. |
first |
1個目の値を空白にする, Default: FALSE. TRUEで強制的に空白にする . inverse = TRUE の時は逆動作となる. |
last |
最後の値を空白にする, Default: FALSE. TRUEで強制的に空白にする. inverse = TRUE の時は逆動作となる. |
inverse |
空白と非空白を逆転させる, Default: FALSE |
comma |
3桁ごとにコンマをつける, Default: FALSE |
ptime |
Parse date-time type vector, Default: FALSE |
ftime |
Format of date-time, Default: '%Y-%m-%d' |
See example and also vignette("repl2blank")
A function
library(ggplot2)
library(magrittr)
library(frabento)
data.frame(year = -6000:1979, haba = treering) %>%
ggplot(aes(x = year, y = haba)) +
geom_line(size = 0.2) +
scale_x_continuous(breaks = seq(-6000, 2000, by = 200),
labels = label_repl2blank(nskip = 4))
# label with comma
data.frame(year = -6000:1979, haba = treering) %>%
ggplot(aes(x = year, y = haba)) +
geom_line(size = 0.2) +
scale_x_continuous(breaks = seq(-6000, 2000, by = 200),
labels = label_repl2blank(nskip = 4, comma = TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.