用坐标绘制单词
Plot words with coordinates
我有一个看起来像这样的数据框:
word x y
"and" 0 0
"the" 0.5 0.4
"some" 1 1
"get" -0.3 0.4
....
我想绘制从 word
到坐标 (x, y)
的单词。
ggplot 会更可取。
试试这个:
require(ggplot2)
df <- data.frame(
words = c("These","Are","Words"),
x = c(1,2,3),
y = c(1,2,3)
)
ggplot(data = df) +
geom_text(aes(x = x, y = y, label=words))
我有一个看起来像这样的数据框:
word x y
"and" 0 0
"the" 0.5 0.4
"some" 1 1
"get" -0.3 0.4
....
我想绘制从 word
到坐标 (x, y)
的单词。
ggplot 会更可取。
试试这个:
require(ggplot2)
df <- data.frame(
words = c("These","Are","Words"),
x = c(1,2,3),
y = c(1,2,3)
)
ggplot(data = df) +
geom_text(aes(x = x, y = y, label=words))