[adegenet-forum] help with sPCA basics: plotting the raster map with xy points

Caroline Judy caroline.duffie at gmail.com
Mon Nov 6 21:37:15 CET 2017


Dear Adegenet forum,

Sorry for the incomplete email I accidentally sent just a few minutes ago.
Here's the full email:

As a first step to the sPCA, I am trying to plot my xy points on the map of
my study region similar to the example "rupica" in the SPCA tutorial that
appears on page 27, using the following code:

plot(data$other$topo.jam)

points(xy,col="red", pch=20)

I don't get an error message, but the points won't draw on the map. A pdf
of the map is attached (sans plots). Is this a format issue with the raster
file? I've tried running the code with the xy data and map stored outside
of the genind object, to no avail.


Thanks in advance for any assistance
---------------

/// GENIND OBJECT /////////

 // 158 individuals; 6,451 loci; 12,902 alleles; size: 10.7 Mb

 // Basic content
   @tab:  158 x 12902 matrix of allele counts
   @loc.n.all: number of alleles per locus (range: 2-2)
   @loc.fac: locus factor for the 12902 columns of @tab
   @all.names: list of allele names for each locus
   @ploidy: ploidy of each individual  (range: 2-2)
   @type:  codom
   @call: read.structure(file = "~/Documents/Trochilus/second_
chapter/Analysis/structure/input/GBS_all_pop_pheno.stru",
    n.ind = 158, n.loc = 6451, onerowperind = TRUE, col.lab = 1,
    col.pop = 2, col.others = 3:8, row.marknames = 0, ask = FALSE)

 // Optional content
   @pop: population of each individual (group size range: 6-37)
   @strata: a data frame with 3 columns ( sex, phenotype, HI )
   @other: a list containing: X  xy  topo  topo.east  topo.jam
------------------------------------------------------------
--------------------------
$topo.jam
class       : RasterLayer
band        : 1  (of  3  bands)
dimensions  : 1416, 2558, 3622128  (nrow, ncol, ncell)
resolution  : 0.0008333333, 0.0008333333  (x, y)
extent      : -78.27649, -76.14482, 17.48716, 18.66716  (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0
data source : /Users/carolineduffie/Documents/Trochilus/second_
chapter/Analysis/PCA/sPCA/jamaica_elevation.tif
names       : jamaica_elevation
values      : 0, 255  (min, max)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171106/7bce060a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: map.pdf
Type: application/pdf
Size: 322686 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171106/7bce060a/attachment-0001.pdf>


More information about the adegenet-forum mailing list