Comments (2)
Hi nehasavant -- late reply, but perhaps it'll help you / others. This is absolutely possible, but I've also had issues before. You can just use the "map" or "plot" commands that you want within the m.plot.xy and q.plot.xy arguments. The only trick is to ensure that you first project the points or shapefiles into the same CRS as the EEMS rasters (use spTransform from the sp / rgdal packages).
-Tim
from eems.
Anything inside the m.plot.xy
and m.plot.xy
is added on top of the raster plot but the statements are not parsed (in order to apply projections, for example). So you have to do it by hand.
Here is the relevant example:
library("rEEMSplots")
extdata_path <- system.file("extdata", package = "rEEMSplots")
eems_results <- file.path(extdata_path, "EEMS-example")
name_figures <- file.path(path.expand("~"), "EEMS-example")
library("rgdal")
projection_none <- "+proj=longlat +datum=WGS84"
projection_mercator <- "+proj=merc +datum=WGS84"
# Start with points specified in (longitude, latitude)
coords <- matrix(c(
-10, 10,
10, 10,
30, 0,
40, -10,
30, -20
), ncol = 2, byrow = TRUE)
colors <- c("red", "green", "blue", "purple", "orange")
labels <- LETTERS[1:5]
# Transform the coordinates into the same projection
# that will be used to transform the migration rates
coords_merc <- sp::spTransform(
SpatialPoints(coords, CRS(projection_none)),
CRS(projection_mercator)
)
# `coords_merc` is a SpatialPoints structure
# but we only need the coordinates themselves
coords_merc <- coords_merc@coords
# So to summarize start with points in one projection
coords
# And project them to the target projection
coords_merc
eems.plots(
mcmcpath = eems_results,
plotpath = paste0(name_figures, "-labels-projected"),
longlat = TRUE,
projection.in = projection_none,
projection.out = projection_mercator,
m.plot.xy = {
text(coords_merc, col = colors, pch = labels, font = 2)
},
q.plot.xy = {
text(coords_merc, col = colors, pch = labels, font = 2)
}
)
from eems.
Related Issues (20)
- Unknown loading error HOT 1
- Using non Euclidean distances HOT 1
- How about treat individuals from one location as a population? HOT 3
- Error building EEMS in a Mac HOT 1
- eems compatibility with eigen and boost HOT 4
- Cropping issue with ggplot maps HOT 11
- Problems to run bed2diffs HOT 2
- Error in .coord file
- Problem compiling plinkio library for bed2diffs HOT 4
- Segmentation fault
- Question about CPU usage for runeems_snps
- Error in .coord file HOT 2
- How to extract value based on coordinate HOT 2
- eems with ngsDist matrix (dealing with missing data, invariant sites, uneven nSites)
- Error while plotting map in make_eems_plots
- the option '--params' is required but missing
- How to improve the acceptance rate of "mBirthDeath"?
- Error: disimilarity matrix is not a full rank matrix HOT 3
- ModuleNotFoundError: No module named 'parameters'
- Error compiling runeems_snps - no sudo permissions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eems.