I'm trying to do a plot from a file generated with the vcftools program at linux. The file looks like:
CHROM BIN_START SNP_COUNT VARIANTS/KB
chr0 0 46 4.6
chr0 10000 34 3.4
chr0 20000 0 0
chr0 30000 21 2.1
chr0 40000 15 1.5
chr0 50000 22 2.2
chr0 60000 22 2.2
chr0 70000 9 0.9
chr0 80000 20 2
chr0 90000 17 1.7
chr0 100000 17 1.7
chr1 0 87 8.7
chr1 10000 96 9.6
chr1 20000 90 9
chr1 30000 124 12.4
chr1 40000 60 6
chr1 50000 89 8.9
chr1 60000 80 8
chr1 70000 170 17
chr1 80000 152 15.2
chr1 90000 98 9.8
chr1 100000 99 9.9
chr2 0 65 6.5
chr2 10000 97 9.7
chr2 20000 68 6.8
chr2 30000 83 8.3
chr2 40000 67 6.7
chr2 50000 76 7.6
chr2 60000 91 9.1
chr2 70000 62 6.2
chr2 80000 40 4
chr2 90000 32 3.2
chr2 100000 45 4.5
With that file I want to create a grouped ggplot with chr0, chr1, chr2 at x-axis and the SNP_COUNT value at y-axis. I tried this:
filepath <- "/example/ggplot.txt"
df <- read.table(filepath, sep = "\t")
ggplot(df, aes(CHROM, SNP_COUNT))
With that code I get the correct distribution:
But the ggplot is empty, any advice would be appreciated thanks.
My desired ggplot with my values: