0

I have 2 data frames

DF1

     NMDS1       NMDS2       NMDS3 id.type Cruzier Station Deep
1  -0.6408266 -0.60298057  0.22242583 Samples      X6     G44  MAX
2  -0.6207177 -0.53097033  0.16097249 Samples      X6     B12  MAX
5  -0.6000443  0.01716781  0.10680716 Samples      X6     G44  MIN
8  -0.5902343  0.22455677  0.01117590 Samples      X5      A1  MIN
9  -0.5873867  0.23577173  0.11075653 Samples      X6     A10  MIN
11 -0.5790668  0.07126742  0.09709558 Samples      X6     F38  MIN
13 -0.5683532 -0.86037558 -0.06146728 Samples      X4     G40  MAX
16 -0.5531412  0.27732626  0.03498156 Samples      X5      A1 1000
17 -0.5525596 -0.56042621  0.11515734 Samples      X6     F38  MAX
19 -0.5472817 -0.63735247 -0.06886957 Samples      X5      A1  MAX

DF2

        NMDS1      NMDS2       NMDS3 id.type   Domain         Phylum               Class             Order
3  -0.6163449 -0.9365917  0.08985319    Taxa Bacteria Proteobacteria Gammaproteobacteria       SAR86 clade
4  -0.6141449 -0.7304946  0.08896511    Taxa Bacteria Proteobacteria Alphaproteobacteria       SAR11 clade
6  -0.5998157 -0.9346313 -0.55145668    Taxa Bacteria  Bacteroidetes         Bacteroidia  Flavobacteriales
7  -0.5952383 -0.7554312 -0.21483445    Taxa Bacteria Proteobacteria Alphaproteobacteria  Rhodospirillales
10 -0.5836874  0.1616950  0.15061434    Taxa Bacteria Proteobacteria Alphaproteobacteria  Rhodospirillales
12 -0.5751439 -0.8349512 -0.12187452    Taxa Bacteria Proteobacteria Alphaproteobacteria  Rhodospirillales
15 -0.5590249  0.3033084  0.15856060    Taxa Bacteria Proteobacteria Gammaproteobacteria Thiomicrospirales
22 -0.5394641 -0.5449049  0.03669729    Taxa Bacteria Proteobacteria Gammaproteobacteria             HOC36
23 -0.5378728  0.3158896  0.02970229    Taxa Bacteria Proteobacteria Alphaproteobacteria     Rickettsiales
31 -0.5288609  0.1189371  0.18211136    Taxa Bacteria Proteobacteria Gammaproteobacteria Thiomicrospirales

so, I want to generate a geom_point with each data frame, so I tried:

ggplot(DF1, aes(x = NMDS1, y = NMDS2)) + 
    geom_point( aes(colour= Deep), size = 3.5, alpha=0.7) + 
    scale_colour_manual(values = c("cyan4", "blue", "orange", "red", "darkgreen")) +
    geom_point(data = DF2, aes(x=NMDS1, y=NMDS2, fill = Order), size = 2.5, alpha=0.7, shape=18) + 
    scale_fill_manual(values = MyPalette20) +
    geom_segment(data = DF2, aes(x = 0, xend=NMDS1, y=0, yend=NMDS2), 
                 arrow = arrow(length = unit(0.25, "cm")),
                 colour = "#CCCCCC",
                 lwd=0.3, linetype="dashed")

My problem is the fill in the geom_point for DF2, it don't get the color, the points are in black, MyPalette20 is the list of the colors that I want to use!!!

any suggestion !

thanks

enter image description here

abraham
  • 661
  • 8
  • 14

1 Answers1

0

I am a bit unsure what you wish for in your plot, but try taking DF1 out of the ggplot() function and in to the first geom_point, so the whole plot does not inherit the data from DF1.

Also, if you provide reproducible data, it's easier to answer.

T. C. Nobel
  • 465
  • 2
  • 9