r - How to output the label of points in scatterplot to bash console -
i have simple r-script:
args <- commandargs(true) inp <- read.csv(args[1],sep="\t",header=false,stringsasfactors=false) firstcol <- inp$v2 secondcol <- inp$v3 pdf(args[2]) plot(firstcol,secondcol,xlab="#",ylab="maxlength") dev.off() i run bash script generate basic plot.
now want use x11() plot directly window , not pdf.
what want appear label (in inp$v1) of every dot on console when hovering on point or klicking onto it.
how do?
the identify function lets click on points , returns index value points clicked on used subset vector of labels.
for identification when hovering (instead of clicking) can @ htkidentify function in teachingdemos package.
edit
here example using identify may more want (i tested on windows, not unix/x11):
x <- runif(26) y <- rnorm(26) plot(x,y) while(length(tmp <- identify(x,y, plot=false, n=1))) { cat(letters[tmp],'\n') } the plot=false tells identify not put label on plot , n=1 tells return after click on 1 point (the while goes identifying more points, prints out label immediately).
obviously create other labels use letters.
Comments
Post a Comment