Displaying 20 results from an estimated 400 matches similar to: "lattice ltext"
2008 May 30
1
Question about adding text to xYplot(Hmisc)
Hello,
I have been trying to make a graph that have error bars and text at
specific position.
I used the following code from the help file of xYplot(Hmisc) as an
example except I add a myPanel function, which is just supposed to add
letters from the alphabet at the position aligned at y = 3.
It constantly gives me error:
"Error using packet 1 argument "subscripts" is
2011 Jan 21
1
Help for lattice. par(new=TRUE)
Hi list,
I want to plot two plot in the same figure. I set par(new=TRUE). But
it does not work.
library(lattice)
myPanel <- function(x,...)
{
panel.histogram(x,alpha=0.4,...)
ltext(0.4,1.5,paste("Mean=","0.05",digit=2)),cex=0.8)
ltext(0.8,1.5,paste("s.d.=","0.06",digit=2)),cex=0.8)
}
histogram(sh2,
2012 Mar 01
2
How to colorize the panel backgrounds of pairs()?
Dear expeRts,
I would like to colorize the backgrounds of a pairs plot according to the respective panel number. Here is what I tried (without success):
count <- 0
mypanel <- function(x, y, ...){
count <<- count+1
bg. <- if(count %in% c(1,4,9,12)) "#FDFF65" else NA
points(x, y, cex=0.5, bg=bg)
}
U <- matrix(runif(4*500), ncol=4)
pairs(U, panel=mypanel)
I
2007 Oct 19
1
Using grid graphics (hexbin) in pairs() plot problem
Hi,
I am trying to create a plot with pairs()
using a gplot.hexbin() for each pair.
For pairs I can provide a custom upperPanel function:
pairs(iris[1:4], panel=mypanel)
and mypanel() calls plot.hexbin():
library(hexbin) # Bioconductor
mypanel <- function(x, ...){
hb <- hexbin(x)
plot(hb)
}
The problem is that gplot.hexbin() is based
on the
2011 Aug 20
1
Groups and bwplot
Dear R-users,
A while ago, Deepayan Sarkar suggested some code that uses the group
argument in bwplot to create some 'side-by-side' boxplots
(https://stat.ethz.ch/pipermail/r-help/2010-February/230065.html). The
example he gave was relatively specific and I wanted to generalize his
approach into a function. Unfortunately, I seem to have some issues
passing the correct arguments to the
2010 Mar 05
4
conditioning variable in panel.xyplot?
I wish to create a multipanel plot (map) from several datasets ("d" and
"q" in the example below). I can condition the main xyplot statement on
the "site" variable, but I don't know how to pass a conditioning variable
to panel.xyplot plot so that the x-y coordinates from dataset q are only
plotted at the appropriate site.
library(lattice)
d <-
2005 Mar 17
1
Varying grid.rect in different panels of a Lattice plot
Dear r-help,
Sleep-deprivation from having 2 youngsters under 2 around the house is
fuzzing my brain, so please be gentle if the answer to this query is obvious!
In the example below, I'm trying to use grid.rect to add grey rectangles to
the panels of a lattice plot to indicate which months spawning occurred of
a (very cute) native Tasmanian fish. The fish in the two lakes spawned at
2008 Mar 27
1
panel function question
I have two data sets with locations, X, Y of houses (df.house) and
habitats(df.habitat), respectively. In each dataset, there are 3
replicates (Repeat). Because each replicate has different locations of
houses and habitats, I would like to plot them in panels. I wrote
something like this:
mypanel<-function(x,y,subscripts,...){
panel.xyplot(x,y,pch=20)
panel.xyplot(
2011 Sep 09
1
Adding groups to regression line panel function in Lattice
I wish to display a single-panel Lattice figure with grouped data and fitted regression lines. I don't seem to be able to get the
individual regression lines to display, e.g.;
d <- data.frame(q = rep(1:6, each=10), cc = rep(seq(10,100, 10),6)) # create data frame with group identifier 'q', independent variable cc
d$ba = d$q*0.1*d$cc + 5*rnorm(nrow(d))
2012 Mar 10
1
Use different panel functions with lattice
Hi,
I have a data.frame df with
names(df) = c("Var1", "Var2", "Var3", "Var4")
and I plot data with
xyplot(Var1+Var2~Var3|Var4, data=df)
I want to use different panel functions for Var1 and Var2.
How can I do ?
Something like :
panel.mypanel = function(x, y, ...) {
if (Var1) panel.Var1Panel(x, y, ...)
else panel.Var2Panel(x, y, ...)
}
2009 Mar 23
1
using xyplot
Dear R-sians!
I am trying generate a bunch of xyplots
library(lattice)
myPanel <- function(x,y,xl=range(x),yl=range(y),...) {
panel.xyplot(x,y, pch=20,col='blue',cex=0.7,xlim=xl,ylim=yl,...)
panel.abline(v=0, col='gray30',lty=2,lwd=1.5,...)
panel.loess(x,y,
span=2/3,family='gaussian',normalize=T,col='red',lwd=1.5,...)
#
2009 Nov 26
1
lattice --- different properties of lines corresponding to type=c("l", "a") respectively
I think the subject says it all. I want to make a simple lattice plot,
using xyplot with the
argument type=c("l","a").
The problem then is that in the resulting plot it is
difficult/impossible to see which plot corresponds to the average
and which to the individual profiles. I triedthings like extra
arguments lwd=c(1,3) or col=c("blue","red")
hoping
2004 Jan 27
1
ltext( pos=NULL )
ltext( 0, 0, pos=NULL, label="xxxx")
gives an error message.
The help page of ``ltext'' references to the help page of ``text''
where the default value of pos is set to NULL.
To solve the problem ``ltext'' could be changed:
OLD:
if (!missing(pos))
NEW:
if (!missing(pos) && ! is.null(pos) )
Wolfram
2004 Apr 14
1
ltext, plotmath, and substitute
I am interested to use plotmath functions within a panel function but am having
some problems getting the code right. Within each panel I am plotting the data,
fitting a regression line, and would like to print the regression equation.
Here is a trivial example of what I'd like to do:
# generate simple data
tmp.df <- data.frame(id = rep(1:4, each=4),
time = rep(1:4, 4),
das =
2002 Feb 15
1
latex in ltext
Hi. I have been able to get things like
text(9,46, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
to work in regular plots but
ltext(9,46, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
does not do the same in lattice (trellis) plots. Has it not been
implemented or am I missing something?
Thanks
- Mary
2009 Oct 30
1
insert a text in panels, always in the same position (lattice, ltext, ?prepanel?)
Dear R-users,
my present problem is related to lattice.
I would like to put some text in each panel, namely a p-value.
I therefore wrote a simple panel function as reported here below.
I'm able to write the value in each panel at the maximum value of y for
each panel,
but this obviously overlay the text to the points.
What I'm looking for is to write the text always in the same
2005 Nov 10
2
ltext - adding text to each panel from a matrix
Hi all (really probably just Deepayan):
In the plot below I want to add text on either side of each violin plot that
indicates the number of observations that are either positive or negative.
I'm trying to do this with ltext() and I've also monkeyed about with
panel.text(). The code below is generally what I want but my calls to
ltext() are wrong and I'm not sure how to fix them.
2010 Apr 06
1
lattice package: line end style
First, apologies for no example data but I don't think it's needed in
this case,
Q: Can (and if so how ) the line end style be changed for 'cloud' plots?
I've tried par(lend=2), trellis.par.set(add.line = list(lend=2)) and
much googling but to no avail
Thanks in advance
Dan
P.S. the reason for this is that the round end looks bad at lwd=3 or
more
Daniel Alcock
Malaria
2010 Jan 26
0
create custom function to annotate a levelplot
Dear list users,
I modeled the probability of occurrence of one species: "Cyperus
dilatatus".
I modeled the species using three different approaches:
c("random","target","index")
What I want to achieve is to make a plot of all prediction maps in a row
with to conditional variables, that is, with the species and the
approach
I prepared a data.frame to try
2012 Mar 29
1
How to access value of the conditioning variable in my panel
Hi,
I have 10 panels in the "mypanel" function of my xyplot based on the conditioning variable and I want to print those ten values, panel headings, groups, .. whatever you want to call them. Easiest way please!
Fayez
[[alternative HTML version deleted]]