Missing dots in plot
1
0
Entering edit mode
8.1 years ago
dirranrak ▴ 20

Hi all,

I am a bit confused with ggplot2. I plotted my data and have some missing data in the plot but not at the legend. I actually have 40 groups (FID) to be plotted and some are missing. My code is:

Data48a <- read.table("Data48a.eigenvec", header = T, sep = "")

PlotData48a <- ggplot(Data48a, aes(x= PC1,y= PC2, group= FID, shape= FID, color= FID))

PlotData48a+geom_point(aes(color=FID))+geom_hline(aes(yintercept=0))+ geom_vline(aes(xintercept=0))+scale_shape_manual(values=1:nlevels(Data48a$FID))+ scale_color_manual(values=1:nlevels(Data48a$FID))+coord_equal(ratio = 1)

and here is the error:

There were 50 or more warnings (use warnings() to see the first 50) . . . 49: In grid.Call.graphics(L_points, x$x, x$y, x$pch, x$size) : unimplemented pch value '28' 50: In grid.Call.graphics(L_points, x$x, x$y, x$pch, x$size) : unimplemented pch value '28'

My data is like:

FID IID PC1 PC2 PC3

Ami AX-AM-013607-1-01 0.0302889 -0.0236855 0.0294569

Ami AX-AM-013608-1-01 0.0346382 -0.0232841 0.0175366

Ami AX-AM-013609-1-01 0.0396438 -0.0157996 0.0163948

Ami AX-AM-013610-1-01 0.0386903 -0.017313 0.0146025

Ami AX-AM-013611-1-01 0.0382764 -0.0151733 0.0222798

Ami AX-AM-013613-1-01 0.0416853 -0.00826403 0.0245685

Ami AX-AM-013614-1-01 0.0388888 -0.0113679 0.0281065

Ami AX-AM-013615-1-01 0.0438035 -0.0102871 0.0156296

Ami AX-AM-013616-1-01 0.0364263 -0.0211585 0.0246802

BatakKaro ID-KR-000001-1-01 0.0321929 0.00520535 0.00480784

BatakKaro ID-KR-000002-1-01 0.0345291 -0.00101008 -0.00264379

BatakKaro ID-KR-000012-1-01 0.0352078 -0.000998926 -0.00847158

BatakKaro ID-KR-000014-1-01 0.0306035 -0.00150602 -0.00365927

Thank you

R • 2.8k views
ADD COMMENT
2
Entering edit mode
8.1 years ago

There are only 26 defined symbols, which is both why you're getting the warnings and why there are missing points. Add a factor for symbol and another for color. This will allow you to support arbitrarily many points, though at some point a bunch of different colors and shapes will become uninterpretable.

ADD COMMENT
0
Entering edit mode

Hi Devon Ryan,

Thanks for the answer and thus I have more questions: 1. I have another data that contains more than 60 groups and why only 5 of them were not present in the plot if there are only 26 symbols? 2. If by combining color with shape we get so many possibility of dot reprensentations, why the missing dots in the plot?

Thank you

ADD REPLY
0
Entering edit mode

My guess is that at some point the pch (the symbol IDs) values start wrapping around (one would have to check the R code).

ADD REPLY

Login before adding your answer.

Traffic: 2026 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6