English 中文(简体)
设法消除所有边缘,使地块区域包括整个图形。
原标题:trying to remove all margins so that plot region comprises the entire graphic
  • 时间:2011-04-14 13:19:38
  •  标签:
  • r
  • plot

我正试图拆除R块地的所有边缘和“图西地区”,以便该地块区包含整个制图装置。 我认为,下面的法典将这样做,但我的阴谋(左上/下下层、右上/右上边的纵深地带)仍有边界。 增 编

par(oma=c(0, 0, 0, 0))
par(mar=c(0, 0, 0, 0))
par(plt=c(0, 1, 0, 1))

虽然我还要说明我的进展情况。 轴心和轴心几乎从上线移走了所有边界,右边仍然有一条边界。

“Rget”/

The relevant portion of my script is below.

png("Test.png", 
     width = 256, height = 256,
     units = "px", pointsize = 6.4, 
     bg = "black", res = NA)

par(mar=c(0, 0, 0, 0), xaxs= i , yaxs= i )


smoothScatter(lhb$px, lhb$pz, nrpoints=0, xlim=c(-3,3), ylim=c(0,5), 
    main="", xlab="", ylab="", axes=FALSE, 
    colramp=colorRampPalette(c("black", "#202020", "#736AFF", "cyan", "yellow", "#F87431", "#FF7F00", "red", "#7E2217"))
    )

segments(.83, 1.597, .83, 3.436, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
segments(-.83, 1.597, -.83, 3.436, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
segments(-.83, 3.436, .83, 3.436, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
segments(-.83, 1.597, .83, 1.597, col = par("fg"), lty = par("lty"), lwd = par("lwd"))


dev.off()
问题回答

一个问题根本不是什么<代码>plt? http://www.un.org。 我们:

 ‘plt’ A vector of the form ‘c(x1, x2, y1, y2)’ giving the
      coordinates of the plot region as fractions of the current
      figure region.

因此,如果您填写par(plt=c(1、1和1),则贵方的地块面积为零,因此,这似乎不是去做的。 这是因为数字区域contains。 该地块区域。

这一阴谋似乎覆盖整个区域,没有任何余地:

op <- par(mar = rep(0, 4))
plot(1:10)
par(op)

it covers it so well you can t see the axes or the box:

“覆盖的”/

This assumes the default for 0 outer margin (oma). Is this what you were looking for?

We can see that just adjusting the plot margins, as above, we also change the plt parameter as a side effect:

> par("plt")
[1] 0.1173174 0.9399106 0.1457273 0.8828467
> op <- par(mar = rep(0, 4))
> par("plt")
[1] 0 1 0 1
> par(op)
> par("plt")
[1] 0.1173174 0.9399106 0.1457273 0.8828467

这表明,仅仅确定地块边缘就足以使地块/地块覆盖整个装置。

当然,还有一条内部禁止的范围,即保险轴面范围略高于<代码>x和y坐标>上的数据范围。 但是,你可以通过<编码>xaxs和yaxs--见?par加以控制。

<>Update: 由于欧佩组织显示,他们试图在没有间隙的情况下生产某种数字,我可以举一个可再生的例子:

set.seed(1)
dat <- matrix(rnorm(100*100), ncol = 100, nrow = 100)

layout(matrix(1:2, ncol = 2))
image(dat)
op <- par(mar = rep(0, 4))
image(dat)
par(op)
layout(1)

比较:

“comparison

and showing just the full plotting region:

“涵盖的整块土地区域”/

铺设单壳区域参数×pd至NA(放入装置)。

par(xpd = NA)





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

热门标签