[R] how to show a plot without overlaying the text on top of the another text?

Jim Lemon drjimlemon at gmail.com
Thu Dec 15 02:25:24 CET 2016


Hi Marna,
Your request made me think that a simple manual label placing function
might be useful to some people.

placeLabels<-function(pointer=TRUE,cex=1,labelcol=par("fg"),
 bg="white",border=par("fg"),pointercol=par("fg")) {

 cat("Enter a blank label to finish\n")
 nextlabel<-"XXX"
 while(nchar(nextlabel)) {
  cat("Click on a data point\n")
  datumxy<-locator(1)
  cat("Click on the label position\n")
  labelxy<-locator(1)
  nextlabel<-readline("Enter the label - ")
  if(nchar(nextlabel)) {
   if(pointer) segments(datumxy$x,datumxy$y,labelxy$x,labelxy$y,
    col=pointercol)
   boxed.labels(labelxy$x,labelxy$y,nextlabel,col=labelcol,
    bg=bg,border=border)
  }
 }
}

All I have to do is work out how to get it to automatically switch
back to the console window for the label entry.

Jim


On Wed, Dec 14, 2016 at 10:37 AM, Marna Wagley <marna.wagley at gmail.com> wrote:
> Hi R user,
> I have created using metaNMDS (Nonmetirc Multidimensional Scaling, MDS) to
> show species composition but some of the species are concentrated at some
> of the sites so that the name of the species are overlaid and it was
> almost impossible to read the species name in the figure. I was wondering how
> we can show the plot without overlaying the text on top of another.
> I used the following to create the plot. would you mind to suggest me?
>
> comm.bc.mds <- metaMDS(dat, dist = "bray")
> ordiplot(comm.bc.mds, display = "sites", type = "text")
> ordipointlabel(comm.bc.mds,font = c(1, 1), cex = c(0.5, 0.3))
>
> Thanks
>
> MW
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list