library(tidyverse)
library(ggrepel)
<- 100
g_width <- 100 * 2 / (1 + sqrt(5))
g_height <- read_csv("
d01 point,value
1,0
2,1
3,2
4,3
5,-1
6,-2
7,-3
", show_col_types = FALSE)
$label <- as.character(d01$value)
d01<- c(1 / 2, -3 / 2, sqrt(2), pi, -sqrt(3))
d02 <- tibble(
d03 point = seq(8, 12),
value = d02,
label = c("frac(1,2)", "-frac(3,2)", "sqrt(2)", "pi", "-sqrt(3)")
#?plotmath で文法は調べられる
) <- bind_rows(d01, d03)
d04 ggplot(d04, aes(value, 1, label = label)) +
geom_pointrange(aes(xmin = -4, xmax = 4)) +
geom_point() +
geom_label_repel(parse = TRUE)
1 基本
1.1 数直線
数直線上に有理数、無理数をプロットする。
2 参考文献
3 R version
R.version.string
[1] "R version 4.4.0 (2024-04-24)"