English 中文(简体)
如何利用R把多层置于一个框架?
原标题:How to put multiple layers in one frame using R?

Im利用R绘制地图文档。

setwd("c:\apa\")
# Load libraries
library("maptools")
library("RColorBrewer")
library("classInt")
library("R2wd")
library("Hmisc")
library("plyr")
library("ggplot2")
library("rgdal")

file.path <- "c:\apa\"
file.name <- "apa_planalto_central"
apa <-readShapePoly(paste(file.path,file.name,sep=""))

file.name <- "AUTORIZACAO_09889652011"
auth <-readShapePoly(paste(file.path,file.name,sep=""))

file.name <- "CLIP_HIDROGRAFIA_APA"
hidro <-readShapeLines(paste(file.path,file.name,sep=""))

file.name <- "ferrovias"
ferrovias <-readShapeLines(paste(file.path,file.name,sep=""))

file.name <- "lagos_df"
lagos <-readShapePoly(paste(file.path,file.name,sep=""))

file.name <- "limite_df"
limites <-readShapeLines(paste(file.path,file.name,sep=""))

file.name <- "rodovias"
rodovias <-readShapeLines(paste(file.path,file.name,sep=""))


plot(apa)
plot(...)

我想用一块地划定所有这些形状(线和聚合物),把所有层层层推向一片土地上,多层层。 这是可能的吗?

最佳回答

你们可以使用以下一些东西:

plot(apa)
plot(auth, add=T)

Just use the add=T within the plot ( function.

问题回答

In ggplot2 you can stack multiple geometries. This would something like:

ggplot(aes(x = x, y = y), data = pointset1) +
  geom_point() +
  geom_polygon(aes(fill = z), data = polyset1) +
  etc

假设所有数据集都在同一预测中,所有数据集都使用X栏的名称,用于X坐标等。 注:ggplot2使用数据、镜子、而不是 sp。 利用起义功能将空间工程物体转化为数据。





相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签