Displaying 20 results from an estimated 9000 matches similar to: "How to suppress plotting for "xyplot(zoo(x))"?"
2010 Nov 26
3
lattice: strange behavior (?) when using trellis.device(color=FALSE)
Dear expeRts,
I am not sure if I found a bug...
I would like to create a function that itself creates a lattice plot without
colors. Following http://www.mail-archive.com/r-help at r-project.org/msg64699.html
I use trellis.device() to set the colors to FALSE. Whenever I call the minimal
example below *with* trellis.device(), Quartz opens a window (I am working on a
MAC), which it shouldn't,
2010 Nov 13
3
How to set an argument such that a function treats it as missing?
Dear expeRts,
I would like to call a function f from a function g with or without an argument.
I use missing() to check if the argument is given. If it is not given, can I set
it to anything such that the following function call (to f) behaves as if the argument
isn't given? It's probably best described by a minimal example (see below).
The reason why I want to do this is, that I do
2010 Dec 29
2
How to create an array of lists of multiple components?
Hi,
how can I create an array of lists of three components?
This approach does not work:
n1 <- 2
n2 <- 4
n3 <- 5
res <- array(rep(vector("list",3), n1*n2*n3), dim = c(n1,n2,n3))
res[1,1,1] # is not a list with three components...
The goal is that res[1,1,1] is a list with three components. Also, appending the
components didn't work. For example, I tried:
component
2006 Mar 04
5
Remove "gray grid" from levelplot
Hi,
If I use the levelplot function of the lattice library, I always see
small "squares" in the plot. They indicate the region for which the
same color is used. If you have a levelplot of a function which is
evaluated at 25x25 equally-spaced points you obtain 26 squares in x
and 26 squares in y direction. That does not bother too much (but
still bothers somehow...), but if you
2008 Jan 01
2
Alignment and Labeling of a color key in a xyplot?
Happy New Year to all R users!
I have two short questions concerning a xyplot with a color key:
1) How do I properly place (align) the color key beside the xyplot?
As you can see from the code listed below, the placement of the color
key is not correct. I would like the upper and lower end point of the
color key to be perfectly aligned with the upper and lower line of
the xyplot. Adjusting
2010 Nov 26
1
How to use expression(italic()) in a "vectorized" way (within a function)?
Dear expeRts,
I would like to use expression() for creating labels in a splom, as shown in the
first minimal example below. Is there any way I can simplify having to write
"expression(italic(...))" several times?
The second example is what I tried so far, but I can't manage to get italic() to
work. Moreover, it still seems bulky...
Cheers,
Marius
## minimal example (working but
2011 Apr 18
4
splom, plotmath: how to add three lines of information with alignment?
Dear expeRts,
I would like to create a scatter plot matrix with splom(). The lower panel should
contain some additional information about the samples shown in the upper panel
plot, see the splom() call below. Now two questions came up:
(1) The lower panels show "tau" and "alpha" on top of each other. How can I plot
*three* expressions on top of each other? I tried several
2006 Mar 04
1
xyplot/levelplot: thickness of tickmarks
Hi,
if I use the xyplot (or levelplot) function (lattice library) with
the option axs="i", I have the problem that the tickmarks lie a bit
outside the "plot-box". Consider for example:
library(lattice)
x<-seq(0,1,by=0.01)
y<-seq(0,1,by=0.01)
xyplot(y~x,type="l",xlim=c(0,1),ylim=c(0,1),scales=list
2010 Dec 30
1
latex() etc.: How to nicely format a matrix for a LaTeX document?
Dear (T)eXpeRts,
I try to create a LaTeX table from an R matrix for the first time. I am not sure what the "best" approach is, I just read about latex() from Hmisc (toLatex() didn't work).
Consider the following minimal example:
library(Hmisc)
mat <- matrix(c(1,NA,3,100,10000,4), ncol = 3, byrow = TRUE)
latex(mat, file = "", booktabs = TRUE, numeric.dollar = FALSE,
2011 Apr 06
7
Quiz: Who finds the nicest form of X_1^\prime?
Dear expeRts,
I would like to create a plotmath-label of the form X_1^\prime. Here is how to *not* do it [not nicely aligned symbols]:
plot(0,0,main=expression(italic(X*minute[1])))
plot(0,0,main=expression(italic(X[1]*minute)))
plot(0,0,main=expression(italic(X)[1]*minute))
Any suggestions?
Cheers,
Marius
2011 Jun 02
2
lattice + plotmath: how to get a variable in bold face?
Dear all,
How can I get a bold "1000" in the title? I would like to use a variable (as opposed to putting in "1000" directly).
library(lattice)
N <- 1000
xyplot(0~0, xlab.top=list(label=as.expression(bquote(bold("foo" ~ .(N) ~ "bar"))), font=2, cex=1.2))
## => "font=2" is ignored (of course)
Cheers,
Marius
2011 Jun 02
2
plotmath: paste string and expression [from a vector of expressions]
Dear all,
I have a vector of expressions and would like to "paste" some string to it before using it in a plot:
vars <- vector("expression", 2)
vars[1] <- expression(alpha)
vars[2] <- expression(beta)
plot(0, 0, main=substitute(bold("Foo" ~~ VAR), list(VAR=vars[2]) ))
Although I tried hard, I just can't figure out how to solve this. The title should be
2010 Dec 22
3
How to integrate a function with additional argument being a vector or matrix?
Dear expeRts,
I somehow don't see why the following does not work:
integrand <- function(x, vec, mat, val) 1 # dummy return value
A <- matrix(runif(16), ncol = 4)
u <- c(0.4, 0.1, 0.2, 0.3)
integrand(0.3, u, A, 4)
integrate(integrand, lower = 0, upper = 1, vec = u, mat = A, val = 4)
I would like to integrate a function ("integrand") which gets an "x" value (the
2006 Feb 12
1
contour lines for levelplot
Hi,
I would like to add contour lines to a (trellis/lattice-) levelplot.
Sure, there is the "contour=TRUE" argument, but this uses
"cuts=..." (which is usually chosen very high for my plots. I guess
cuts=99 is the best you can do (?)) for plotting the contour lines.
Furthermore, I do not like the numbering of the contour lines this
way. Therefore, I tried to add a
2011 Oct 02
1
plot: how to fix the ratio of the plot box?
Dear all,
this should be trivial, but I couldn't figure out how to solve it... I would like to have a plot with fixed aspect ratio of 1. Whenever I resize the Quartz window, the axes are extended so that the plot fills the whole window. However, if you have different extensions for the different axes, the plot does not look like "a square" anymore (i.e., aspect ratio 1). The same
2010 Jun 23
1
how to print a colored plot in black/white?
Dear expeRts,
shouldn't this...
x <- 1:10
myplot <- xyplot(x~x,col="red")
trellis.device(postscript,color=FALSE,file="plot.ps")
print(myplot)
dev.off()
... give a black/white plot?
Cheers,
Marius
2011 Jun 02
1
[R-SIG-Mac] check leads to .o files and to packagename-Ex.R
On 06/02/2011 06:47 AM, Benilton Carvalho wrote:
> 'R CMD check' should be applied on the .tar.gz, not on the source directory.
Why? The help says: "Check R packages from package sources, which can
be directories or package 'tar' archives with extension '.tar.gz',
'.tar.bz2' or '.tgz'." I just skimmed through the relevant section
(1.3.1) in
2006 May 29
3
mtext in trellis-loop & colorkey
Hello,
I would like to create a sequence of plots (using a for loop). I read
in the FAQ that print() has to be used in order to obtain any output.
This works perfectly fine as long as I only consider one function
call in the loop, but I would like to add mtext() to the each plot in
the loop. Unfortunately, this did not work. Any suggestions?
As you can see from the provided example,
2011 May 11
1
foreach(): how to do calculations "between" two foreach loops?
Dear expeRts,
is it possible to carry out calculations between different foreach() calls?
As for nested loops, you want to carry out calcuations not depending on the inner
loop only once and not for each iteration of the innermost loop.
Cheers,
Marius
library(foreach)
foreach(i=1:3) %:%
foreach(j=1:2) %do% {
i <- i+1
print(paste(i,j))
}
foreach(i=1:3) %:%
i
2011 Jun 21
2
Tricky (?) conversion from data.frame to matrix where not all pairs exist
Dear expeRts,
In the minimal example below, I have a data.frame containing three "blocks" of years
(the years are subsets of 2000 to 2002). For each year and block a certain "value" is given.
I would like to create a matrix that has row names given by all years ("2000", "2001", "2002"),
and column names given by all blocks ("a",