How to Prevent Overlap

I can't seem to prevent overlap, even after realigning the site labels. Is there any way I can prevent this overlap?

WD <- "C:/Users/..."
setwd(WD)
require(vegan)
phylum.dat <- read.csv("Condensed Phylum data for R.csv", stringsAsFactors = T, header = T, row.names = 1)
phylum.t1 <- decostand(phylum.dat, "total")
phylum.t2 <- decostand(phylum.t1, "max")
phylum.t2.dca <- decorana(phylum.t2)
phylum.t2.dca.DW <- decorana(phylum.t2, iweigh = 1)
names(phylum.t2.dca)
summary(phylum.t2.dca)
phylum.t2.dca.taxonscores <- scores(phylum.t2.dca,display=c("species"), choices=c(1,2))
plot(phylum.t2.dca, display = "none", type = "text", main = "Phylum")
point_colors <- c(rep("blue", 4), rep("red", 4), rep("green", 4))
points(phylum.t2.dca, display = "site", choices = 1:2, pch = c(15, 16, 17, 18), col = point_colors)
text(phylum.t2.dca, display = "species", choices = 1:2, cex = 0.8, col = "darkcyan")
text(phylum.t2.dca, display = "sites", cex = 0.8, pos = 4)
treat=c(rep("Treatment1",4), rep("Treatment2",4), rep("Treatment3",4))
ordihull(phylum.t2.dca,groups=treat, draw = "lines", col= c("blue", "red", "green"), label=F)

I can't access your data as its local to your csv. use dput on your object to make it shareable in a copy pasteable way on the forum.

That aside, here are 3 images using different tools.

  1. plotting in base R
set.seed(43)

x <- sample.int(10,10,replace = TRUE) 
y <- sample.int(10,10,replace = TRUE)
l <- letters[1:10]
plot(x,y)
text(x,y,l)

image

plotting with ggplot/tidyverse

library(tidyverse)
ggplot(data=data.frame(x,y,l),
       mapping=aes(x=x ,
                   y=y,
                   label = l)) + 
  geom_point() + 
  geom_label()

image

  1. plotting with ggplot and ggrepel

library(ggrepel)

ggplot(data=data.frame(x,y,l),
       mapping=aes(x=x ,
                   y=y,
                   label = l)) + 
  geom_point() + 
  geom_label_repel()

image

1 Like

Here's my dput.

structure(list(p__Proteobacteria = c(44.807, 40.907, 36.558,
36.811, 39.401, 40.114, 45.911, 43.133, 30.137, 27.734, 26.722,
31.261), p__Actinobacteria = c(26.819, 34.651, 40.904, 38.847,
39.446, 37.523, 29.881, 29.251, 31.783, 23.641, 34.918, 31.308
), p__Acidobacteria = c(8.48, 6.6, 5.934, 6.609, 5.89, 7.567,
5.795, 6.666, 10.616, 10.709, 8.988, 11.794), p__Bacteroidetes = c(7.56,
8.189, 5.363, 6.223, 4.716, 3.613, 4.65, 5.2, 4.281, 2.785, 2.808,
3.271), p__Gemmatimonadetes = c(3.529, 2.108, 1.213, 1.193, 1.541,
1.439, 1.006, 1.171, 5.794, 4.107, 4.001, 2.747), p__Chloroflexi = c(2.686,
2.987, 2.979, 3.049, 4.128, 4.564, 5.304, 4.624, 3.669, 2.775,
4.534, 4.94), p__Bacteria_unclassified = c(2.38, 1.869, 1.579,
1.247, 2.3, 2.108, 1.36, 1.193, 3.126, 1.885, 2.987, 2.37), p__Firmicutes = c(0.998,
0.807, 2.76, 2.962, 0.866, 1.32, 1.651, 2.073, 1.099, 1.046,
1.3, 1.302), p__Cyanobacteria = c(0.079, 0.048, 1.071, 1.372,
0.32, 0.19, 2.629, 4.689, 7.133, 22.963, 11.417, 8.767), p__Other = c(2.662,
1.834, 1.634, 1.684, 1.39, 1.559, 1.811, 2.002, 2.363, 2.358,
2.326, 2.239)), class = "data.frame", row.names = c("D15B", "D610B",
"D15F", "D610F", "HR15B", "HR610B", "HR15F", "HR610F", "C15B",
"C610B", "C15F", "C610F"))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.