Displaying 20 results from an estimated 10000 matches similar to: "xyplot, panel.abline, from, to"
2006 Jun 08
1
panel.abline and xyplot
Dear All,
I am wondering on how to use the abline.xyplot with xyplot such that I will have different vertical lines for each panel. More sepcifically, suppose that the xyplot generates 4 panels defined by the combination of two binary variables: X_1 and X_2. i.e.
xyplot(Y ~ Z | X_1*X_2, data = df)
I want something like:
abline(v = 5) if X_1=0 and X_2 = 0
abline(v =
2010 Dec 09
4
[lattice xyplot] Help needed in help in customizing the panel.abline() function
Hi folks,
I need some help in customizing the abline() function to be used in a
lattice plot. I have attached a reproducible example below.
I need help in the following snippet:
disc <- xyplot(cnt_gt50pct_disc ~ week_num|sku_num, data=DF,type =
"h",lwd=2,panel = function(...) {
panel.abline(v = 8, lty = 2)
panel.xyplot(...)
})
Is there a way I can give
2007 Aug 13
1
'From' and 'to' arguments in panel.abline
Dear R-users,
The help does not give much details on the use of the arguments 'from'
and 'to' in the panel.abline function. I have looked in the archives but
did not find how to implement them. My different tries failed miserably.
E.g, the following code doesn't seem to work, in a sense that the line
is not limited to the (0,10) range.
Do these arguments really apply to
2006 Jan 31
0
lattice: combining panel.xyplot with panel.abline - is thispossible?
Well, one way to do it is
xyplot(y~time|id, data=dat,type='l',
panel=function(x,y,subscripts,...){
panel.xyplot(x,y,subscripts,...)
panel.abline(v=dat[subscripts,"cm1"])
panel.abline(v=dat[subscripts,"cm2"])
}
)
Since I don't know what the dataframe 'mergeData' is I have used 'dat'.
Best regards
Frede Aakmann
2009 Feb 20
4
adding a reference line to an xyplot
Hi,
I want to add a dashed vertical line to a number of xyplots.
Here is a simple script of the type of plot I have but then I want to add a
reference line to 1995 on each of the panels. I have tried panel.abline and
other suggestions on the forum but can't get it to work.
plot<-rep(letters[1:3],each=10)
year<-rep(1991:2000,times=3)
matter<-rep(seq(2,6.5,0.5),times=3)
2005 Apr 12
2
abline() with xyplot()
Hello all,
I'm a new user on R, and I used the abline function to draw a line on my graph but it doesn't work with xyplot(). With the plot function, abline() is ok but with plot it doesn't make what I want. Maybe it's a little thing to change in plot() but I don't find what!
With xyplot I write this :
Xyplot(m~ordered(l,levels=1),
2006 Jan 31
0
lattice: combining panel.xyplot with panel.abline - is this possible?
Consider this data frame:
dat<-data.frame(id=gl(3,5),time=rep(1:5,3),cm1=rep(c(2,3,4),each=5),cm2=rep(c(2.5,3.5,4.5),each=5),y=rnorm(15))
> dat
id time cm1 cm2 y
1 1 1 2 2.5 -1.0824549
2 1 2 2 2.5 -0.7784834
3 1 3 2 2.5 -1.7783560
4 1 4 2 2.5 0.5056637
5 1 5 2 2.5 -0.1967505
6 2 1 3 3.5 1.1643136
7 2 2 3 3.5 -1.4323765
8 2
2011 Aug 12
1
lattice panel.abline use
Dear R-users,
I am unsuccessful in trying to add an horizontal line to all graphs in the
example below:
library(lattice)
val<-runif(15)
x<-rep(seq(1:5),3)
type<-c(rep("a",5), rep("b",5), rep("c",5))
xyplot(val ~ x | type, panel.abline(h=.6))
Any hints are appreciated.
Best regards,
---Jean
--
View this message in context:
2009 Jan 12
1
Problem between panel.abline and log scales (lattice)
Hello and Happy New Year to all R-Users !!!
I would like to plot a lattice graph with a logarthmic y axis and add two
reference lines that is :
ref<-c(0.0070, 0.0096)
graph1<-xyplot(data$y1 ~ as.numeric(strptime(data$x1, format="%Y-%m-%d
%H:%M:%S")) | as.character(data$Code),
list(y = list(log = T)),
xlab="X'", ylab="Y",
panel = function(...) {
2010 Aug 19
1
Adding lines to xyplot with abline
Is it kosher to add, say, horizontal lines to a lattice xyplot using
abline(h=xxx)? The lines don't appear at the right value, that is, if
h=150, the line might appear at h=140?
Jeff
This communication, including any attachments, is intended solely for the use of the addressee and may contain information which is privileged, confidential, exempt from disclosure under applicable law or
2007 Feb 21
3
Different gridlines per panel in xyplot
In the example R script below, horizontal gray gridlines are drawn at y
coordinates where the points are drawn with the code:
panel.abline(h=y, v=xScale, col.line="gray")
How do I change this so that the horizontal gray gridlines are drawn at y
coordinates where the y labels are drawn? The challenge is that each panel
has different y-ranges (in my real example the y-ranges and
2008 Jun 27
1
xyplot and separate abline per plot
Hello list!
I have a set of data like this:
> alldata[1:5,]
breaks numbers disttype moltype type
1 0.0000000 6598 Gapped Distances 5S Between species
2 0.4066667 0 Gapped Distances 5S Between species
3 0.8133333 5228 Gapped Distances 5S Between species
4 1.2200000 0 Gapped Distances 5S Between species
5 1.6266667 9702 Gapped
2012 Mar 29
1
abline with xyplot does not work
I am trying to plot the results of a random effects model where each subject is allowed to have his, or her, own intercept. I use xyplot to plot the data, lme to compute the regression and then try to put a summary regression line on the xyplot. As can be seen by the output pasted below, I am getting an error message,
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
(list)
2006 Apr 04
2
xyplot: getting data into the panel function
In xyplot, I would like to get the "data into the panel function" in the following sense: Consider
xyplot(scc~time|cowidp, data=cow.s,type=c("l"),
panel=function(x,y,subscripts,...){
panel.xyplot(x,y,...)
vvv<-cow.s[which(!is.na(cow.s[subscripts,"mastreat"])),"time"]
panel.abline(v=vvv,col="red",lwd=2)
}
)
If I want to use a
2009 Apr 30
1
Hmisc: xYplot and panel.lines
Using the Hmisc package, I tried to create an xYplot (single panel
only) and was confused to find that I could not add anything else to
the plot (abline, lines, etc.).
Thankfully, [1] points out panel functions.
This works as expected for panel.abline, but as soon as I'm using
panel.lines (or llines or lpoints) from the "lattice" package (version
0.17-17 with R 2.8.1), it
2007 Nov 20
2
Adding points on top of lines in xyplot
All,
I'm trying to make a basic plot: data points superimposed upon the a line
connecting the points w/ a different color. Example below doesn't work as
the first xyplot call doesn't remain. Suggestions?
David
Hour = c(NA,1,2,3,4)
y = c(2,2,3,2,1.5)
xyplot(y ~ Hour, xlab = list("Hour", font=2, cex=2), ylab= list("U_x * V",
font=2, cex=2), type = 'l',
2008 Jul 02
1
auto.key in xyplot in conjunction with panel.text
All,
I can't seem to get auto.key to work properly in an xyplot that is employing
panel.text. Specifically, I often change the default grouping colors then
use auto.key accordingly, but for some reason the same functionality isn't
working for this different type of plot. Any help much appreciated.
Cheers,
David
library("lattice")
dat = data.frame( Y = c(rnorm(18,1),
2008 Jun 26
3
Connecting lines across missing data points, xyplot
All,
I have data across 5 time points that I am graphing via xyplot, along with
error bars. For one of the variables I have missing data for two of the
time points. The code below is okay but I can't seem to get the lines to
connect across the missing time points. Does anyone now how to rectify
this?
Cheers,
David Afshartous
library(lattice)
## the data
junk = data.frame(
Visit =
2011 Aug 24
2
Suppressing error messages printed in xyplot() with panel function
Hello,
I am using the xyplot() function to create a series of scatterplot
panels with lines of best fit. To draw the lines of best fit for each
panel, I am using a panel function. Here's an example:
> species <- as.character(c(rep(list("A", "B", "A"), 10), "B"))
> year <- as.character(c(rep(list("2009", "2009",
2008 Feb 28
2
Replacing plot symbols w/ subject IDs in xyplot()
All,
How does one replace plot symbols with say subject IDs when using xyplot? Or
superimpose them next to plot symbols? I searched the archives under
various key words but haven't had much. Any suggestions or links much
appreciated. Sample code below.
David
junk.frm = data.frame(ID = rep(1:16, each = 2), x, y, z = rep(c("D", "P"),
16))
y = c( 0.4, 0.6, -0.1,