[adegenet-forum] help with sPCA basics: plotting a raster map with xy points overlaid
Caroline Judy
caroline.duffie at gmail.com
Mon Nov 6 21:25:38 CET 2017
Dear Adegenet forum,
As a first step to the sPCA, I am trying to plot the xy points on the topo
map using the following code similar to the example "rupica" in the SPCA
tutorial that appears on page 27.
plot(data$other$topo.jam)
points(xy,col="red", pch=20)
Both the xy points and the map of my study region are part of the Genind
object I created, see details below.
---------------
/// 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/a33d71f9/attachment.html>
More information about the adegenet-forum
mailing list