Adding labels to datapoints on plot in R -


i'm trying put labels on datapoints in plot find top 5 countries smallest population.

smallestpop.order = order(population$x2014) smallref = population[smallestpop.order,] smallref[1:5,] plot(smallref[1:5,3:,])  text(smallref[1:5],labels=smallref$country.code[1:5],adj = null,  pos = 1, offset = 0.5, vfont = null,  cex = 1, col = null, font = null) 

this how plot looks like

enter image description here

but have country code on each of datapoints. possible?

scatterplotmatrix() in car package has arg id.n control point labeling , id.method provode variety of methods.

you want use like

scatterplotmatrix(population, id.n=5, id.method="y") 

by default, row names of observations used point labels.


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -