2017-10-13 6 views
1

Actuellement en train d'essayer d'utiliser des données extraites pour créer deux biplots RDA distincts. En utilisant le code qui suit:Création d'un biplot RDA à l'aide de résultats RDA extraits et fusion en graphiques

p <- ggplot() 
p + geom_vline(x=0,colour="grey50") + 
    geom_hline(y=0,colour="grey50") + 
    geom_text(data = PHYTOPLANKTON_coordinates_scaling_2, aes(x = RDA1, y = RDA2, 
      label=rownames(PHYTOPLANKTON_coordinates_scaling_2)), angle=45, size=3, 
      colour = 'blue') + 
    geom_segment(data = WQ_coordinates_scaling_2, aes(x = 0, y = 0, 
      xend = RDA1, yend = RDA2), size = 0.5, colour = 'red') + 
    geom_text(WQ_coordinates_scaling_2, aes(x = RDA1, y = RDA2, 
      label = rownames(WQ_coordinates_scaling_2)), size = 5, angle = 45, 
      vjust = 1, colour = 'violet') + 
    theme_bw() 

Il en résulte:

Error: unexpected '=' in: " + geom_text(data = PHYTOPLANKTON_coordinates_scaling_2, aes(x = RDA1, y = RDA2, + label=" + colour = 'blue') Error: unexpected ')' in " + colour = 'blue')"

+1

s'il vous plaît modifier votre message selon SO lignes directrices. – Al14

Répondre

0
set.seed(123) 
# Generate toy data 
n <- 20 
PHYTOPLANKTON_coordinates_scaling_2 <- 
data.frame(RDA1 = rnorm(n), RDA2 = rnorm(n)) 
rownames(PHYTOPLANKTON_coordinates_scaling_2) <- LETTERS[1:n]  
k <- 4 
WQ_coordinates_scaling_2 <- 
data.frame(RDA1 = rnorm(k), RDA2 = rnorm(k)) 
rownames(WQ_coordinates_scaling_2) <- paste0("V",1:k) 

# Plot data 
library(ggplot2) 
p <- ggplot() 
p + geom_vline(xintercept=0,colour="grey50") + 
    geom_hline(yintercept=0,colour="grey50") + 
    geom_text(data=PHYTOPLANKTON_coordinates_scaling_2, aes(x=RDA1, y=RDA2, 
      label=rownames(PHYTOPLANKTON_coordinates_scaling_2)), angle=45, size=3, 
      colour = 'blue') + 
    geom_segment(data=WQ_coordinates_scaling_2, aes(x = 0, y = 0, 
      xend = RDA1, yend = RDA2), size = 0.5, colour = 'red') + 
    geom_text(data=WQ_coordinates_scaling_2, aes(x=RDA1, y=RDA2, 
      label = rownames(WQ_coordinates_scaling_2)), size = 5, angle = 45, 
      vjust = 1, colour = 'violet') + 
    theme_bw() 

enter image description here