|
a |
|
b/man/spatstat_layout.Rd |
|
|
1 |
% Generated by roxygen2: do not edit by hand |
|
|
2 |
% Please edit documentation in R/3-1.layout.R |
|
|
3 |
\name{spatstat_layout} |
|
|
4 |
\alias{spatstat_layout} |
|
|
5 |
\title{Generate spatial layout using \code{spatstat}} |
|
|
6 |
\usage{ |
|
|
7 |
spatstat_layout( |
|
|
8 |
go, |
|
|
9 |
win, |
|
|
10 |
type = c("random", "regular"), |
|
|
11 |
mode = c("surface", "boundary"), |
|
|
12 |
jitter = 0, |
|
|
13 |
curved = NULL, |
|
|
14 |
order_by = NULL, |
|
|
15 |
order_ls = NULL, |
|
|
16 |
seed = 1234, |
|
|
17 |
rescale = TRUE |
|
|
18 |
) |
|
|
19 |
} |
|
|
20 |
\arguments{ |
|
|
21 |
\item{go}{igraph or metanet object} |
|
|
22 |
|
|
|
23 |
\item{win}{A spatstat window object (owin), e.g. disc(), owin(poly=...); Or sf object.} |
|
|
24 |
|
|
|
25 |
\item{type}{Type of distribution: "random", "regular"} |
|
|
26 |
|
|
|
27 |
\item{mode}{"surface", "boundary"} |
|
|
28 |
|
|
|
29 |
\item{jitter}{for surface-regular, defalut 0} |
|
|
30 |
|
|
|
31 |
\item{curved}{Optional curved attribute for coors} |
|
|
32 |
|
|
|
33 |
\item{order_by}{order nodes according to a node attribute} |
|
|
34 |
|
|
|
35 |
\item{order_ls}{manual the discrete variable with a vector, or continuous variable with "desc" to decreasing} |
|
|
36 |
|
|
|
37 |
\item{seed}{random seed} |
|
|
38 |
|
|
|
39 |
\item{rescale}{rescale the coordinates to (0,1)} |
|
|
40 |
} |
|
|
41 |
\value{ |
|
|
42 |
A coors object (data.frame with class "coors" and attribute "curved") |
|
|
43 |
} |
|
|
44 |
\description{ |
|
|
45 |
Generate spatial layout using \code{spatstat} |
|
|
46 |
} |
|
|
47 |
\examples{ |
|
|
48 |
\donttest{ |
|
|
49 |
if (requireNamespace("spatstat.geom") && requireNamespace("spatstat.random")) { |
|
|
50 |
poly_x <- c(0, 2, 2, 0) |
|
|
51 |
poly_y <- c(0, 0, 1, 1) |
|
|
52 |
win_poly <- spatstat.geom::owin(poly = list(x = poly_x, y = poly_y)) |
|
|
53 |
plot(win_poly) |
|
|
54 |
coors1 <- spatstat_layout(co_net, win_poly, type = "regular", mode = "surface") |
|
|
55 |
plot(co_net, coors = coors1) |
|
|
56 |
coors2 <- spatstat_layout(co_net2, win_poly, type = "random", mode = "boundary") |
|
|
57 |
plot(co_net2, coors = coors2) |
|
|
58 |
|
|
|
59 |
if (requireNamespace("sf")) { |
|
|
60 |
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) |
|
|
61 |
poly <- nc[1, ] |
|
|
62 |
coors <- spatstat_layout(go = multi1, win = poly, type = "regular", mode = "surface") |
|
|
63 |
plot(multi1, coors = coors) |
|
|
64 |
} |
|
|
65 |
} |
|
|
66 |
} |
|
|
67 |
} |