[英]Labeling specific points of a scatter plot
我想繪制僅包含符合我的條件的特定標簽的散點圖
我有一個看起來像的數據框df
In.Deg `Out.Deg Name
34 38 ABC
56 45 Dummy
53 54 Another_Dummy
我只希望在圖中標記符合條件的值(In.Deg> 50&Out.Deg> 50)。
我只想顯示Another_Dummy。 我不希望在繪圖時將其他名稱顯示為標簽。
感謝幫助
## read in your data
d <- read.table(header = TRUE, text = "In.Deg Out.Deg Name
34 38 ABC
56 45 Dummy
53 54 Another_Dummy ")
## subset and plot with label
s <- subset(d, In.Deg > 50 & Out.Deg > 50)
with(d, plot(In.Deg, Out.Deg))
text(s[,1:2], labels = s[,3], pos = 1)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.