English 中文(简体)
• 如何在使用latt(不工作的一些how)的层次上添加线?
原标题:How to add lines to a levelplot made using lattice (abline somehow not working)?
  • 时间:2011-10-01 18:12:43
  •  标签:
  • r
  • lattice

我想在我相当于x价值(74至76岁)和28至32年价值(28至32岁)的平方位和纵向界限。 以下是我的《区域法典》。 但是,当我管理以下活动时,我会得到一些层次的探索,但没有线索。 我还从R中找不到错误。 我安装上的缺省主题是向ink和yan看的。 我也尝试利用小组的职能,但没有这样做。

levelplot(d_fire_count_nom ~ longitude + latitude | factor(day)+factor(year), 
          data = asia,
          subset = (month == 10),  aspect="iso", contour = FALSE, layout=c(1,1), 
          main="If a fire occured in a region (low confidence) in October during 2001-2008", 
          scales=list(x=list(at=seq(from=60,to=98, by=1)), 
                      y=list(at=seq(from=5,to=38,by=1)),cex=.7, alternating=3), 
          xlim=c(60, 98), ylim=c(5, 38),
          abline=list(h=74:76, v=28:32, col="grey"))
问题回答

That s not how lattice graphics work. In fact, if you read ?levelplot you ll see that there is no argument to that function called abline, so I m not sure where you got that syntax from.

页: 1 更改<代码>panel功能的图表。 有许多<代码>panel.*功能,可以做各种事情,如点 plot点、线、散射机等。 在这种情况下,我们想要使用的是<代码>panel.abline。 因此,我们界定了自己的<代码>panel功能。

采用<代码>第1个例子:

x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
levelplot(z~x*y, grid,
        panel = function(...){
            panel.levelplot(...)
            panel.abline(h = 2.5)
            panel.abline(v = 2.5)
        }, 
        cuts = 50, scales=list(log="e"), xlab="",
        ylab="", main="Weird Function", sub="with log scales",
        colorkey = FALSE, region = TRUE)

我们的新小组职能首先需要利用这一层次,因此,我们首先要使用<条码>。 然后,我们要添加一些行文,为此添加<条码>panel.abline。





相关问题
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 ...

热门标签