Question
I'm trying to label the points of an ECDF plot with another column from my data field. Currently I'm using this:
untouched = read.table("results-untouched.tsv", sep="\t")
plot.ecdf(untouched$V4, xlim=c(0.75,1.25), ylim=c(0,1), col='green', verticals=T)
which plots allright, but I'm then unable to add the labels to the points. The labels would be in untouched$V1
.
Any idea on how to do this?
Solution
To add labels, you can use the text
function. For example, we generate some data
x = sort(rnorm(10))
then create the ecdf object (plot.ecdf
does this automatically),
m = ecdf(x)
and plot m
plot(m)
To add labels, we use the text
function. The x coordinates are the data, the y coordinates are the output from the ecdf
function (with an additional 0.03 to avoid over-plotting):
text(x, m(x) + 0.03, LETTERS[1:10])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow