在基 R 中用派生轴标记散点图点

Label scatterplot points with derived axis in base R

我的数据是这样的:

> dput(head(GDP_NUTS2,5))

structure(list(Regiao = c("N", "Ag", "C", "AML", "Al"), t2000 = c(10054.60679, 
13045.59069, 10621.51789, 18104.36306, 11585.29235), t2001 = c(10652.46712, 
13920.41552, 11101.08412, 18865.55149, 12014.61685), t2002 = c(11001.34917, 
14612.37052, 11507.36163, 19812.29293, 12411.44835), t2003 = c(11031.7278, 
15137.89461, 11884.96687, 20165.68892, 12889.20298), t2004 = c(11354.02317, 
15479.68985, 12364.05053, 21068.05117, 13448.52482), t2005 = c(11875.44359, 
16237.49791, 12754.40299, 21829.31373, 13867.5055), t2006 = c(12439.6426, 
17046.29326, 13378.47797, 22714.25829, 14767.48968), t2007 = c(13229.02402, 
17981.40383, 14044.39707, 23847.44923, 15362.11238), t2008 = c(13579.51144, 
18226.74178, 14091.85326, 24347.83971, 15335.54822), t2009 = c(13243.19054, 
17038.45595, 13974.46502, 23794.44899, 14836.93236), t2010 = c(13677.38358, 
16976.83391, 14284.14565, 24119.66719, 15489.72008), t2011 = c(13491.68626, 
16347.69468, 14011.54637, 23503.1765, 15200.84829), t2012 = c(13111.6173, 
16059.51047, 13623.68635, 22118.01701, 14510.73391), t2013 = c(13473.68717, 
16301.87448, 13919.18355, 22337.24739, 14628.8829), t2014 = c(13935.07757, 
16974.57715, 14220.1043, 22491.62875, 15021.05459), t2015 = c(14570.33755, 
17851.78088, 14983.95312, 23101.89351, 16297.81693), t2016 = c(15283.33044, 
19251.57661, 15620.77307, 23800.20038, 16737.39734), t2017 = c(16083.53849, 
20893.19975, 16410.11278, 24938.22636, 17888.34779), t2018 = c(17031.94867, 
22131.96942, 17242.70015, 25974.24055, 18396.58684), t2019 = c(17712.44223, 
23145.30242, 18045.54697, 26970.71178, 19006.1632)), row.names = c(NA, 
-5L), class = c("tbl_df", "tbl", "data.frame"))

为了制作 beta 收敛图,我使用了这个预制代码:

rca(GDP_NUTS2$t2000, 2000, GDP_NUTS2[3:21], 2019,  
    conditions=NULL, beta.plot=TRUE, beta.plotLine=TRUE, 
    beta.plotX="Ln (initial GDP p.c.)", beta.plotY="Ln (av. growth GDP p.c.)",
    beta.plotTitle="Beta convergence of Portuguese regions 2000-2019")

由于轴来自包装函数 rca 而不是直接来自数据集,我不知道如何用行名称标记散点图点。我看到的所有示例都具有完全不同的代码图结构。

我们将不胜感激任何帮助。

您没有为 运行 您的代码提供足够的数据,因此我将使用 rca.

手册页示例中的修改后的数据集
library(REAT)
data (G.counties.gdp)   # GDP for German counties
Example <- G.counties.gdp[1:50, ]     # Just use the first 50 rows
out <- rca (Example$gdppc2010, 2010, Example$gdppc2011, 2011, 
       conditions = NULL, beta.plot = TRUE)
x <- out$betaconv$regdata$ln_initial
y <- out$betaconv$regdata$ln_growth
text(x, y, 1:50, pos=3, cex=.8)

轴的数据存储在当您 运行 函数(如果您分配它)时返回的对象中。这是情节: