簡體   English   中英

R 中是否有任何函數可以在散點圖的圓圈內提供標簽?

[英]Is there any function in R that gives the labels inside the circles of a scatter plot?

我試圖創建一個散點圖,其中標簽嵌入在帶有 ggplot 的圓圈內。 有什么功能可以在圓圈內標記嗎?

提前致謝。

如果您想要圓圈內的文本,只需繪制圓圈,然后在同一位置繪制文本:

df <- data.frame(x = runif(26), y = runif(26), z = LETTERS)

ggplot(df, aes(x, y, label = z)) +
  geom_point(size = 10, shape = 21, fill = "white") +
  geom_text(vjust = 0.4)

在此處輸入圖片說明

geom_label()怎么ggplot2

library(ggplot2)


ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) + 
  geom_label()

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM