Displaying 20 results from an estimated 20000 matches similar to: "Assigning line colors in xyplot"
2006 Aug 25
2
xyplot with different symbols and colors?
Dear List,
I try to make a xyplot with different colors and symbols, I came this far:
library(DAAG)
xyplot(csoa~it|sex*agegp,data=tinting,groups=target,pch=list(1,2),auto.key=list(space
= "right"))
this produces a plot with different colors and symbols but unfortunately
the legend does only follow the color scheme and not the different symbols.
Any suggestions what to change?
And
2009 Feb 11
1
2 different colors for 2 groups of lines using xyplot
Hi All,
I am trying to use xyplot to plot several lines in one panel with red
color for a group of lines, say 3 lines and blue color for another
group of lines, say 4. I know this can be easily done using regular
plot function. But i could not figure out how to do this in xyplot.
Any help would be greatly appreciated.
Xuesong
[[alternative HTML version
2010 Apr 29
3
control span in panel.loess in xyplot
Dear R gurus..
Is it possible to control span settings for different values of a grouping
variable, when using xyplot? an example code shown below
d=data.frame(x=rep(sample(1:5,rep=F),10),y=rnorm(50),z=rep(sample(LETTERS[1:2],rep=F),25))
xyplot(y~x,data=d,groups=z,panel=panel.superpose,panel.groups=panel.loess(span=c(2/3,
3/4,1/2))
or something like..
2010 Sep 03
3
define colors for groups in lattice xyplot
Dear all,
Lattice provides automatic coloring for subgroups on each panel by the
simple use of a groups statement. For an application I want to change
these colors to a predifined set. This works well using a panel function
in stead of the default as long as there are only points in the graphs.
When I set type="b" things get messed up. Any idea why? I include sample
code for
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),
2002 Oct 15
2
glm and Newey-West estimator
Dear R-users,
has anybody combined the glm function with the Newey-West estimator of
variance, similar as in Stata 7.0? I'd like to estimate corrected
standard errors within a logistic regression model, taking into account
the auto-correlated binary observations within individuals.
I use R1.5.1 on Mac OS X (10.2).
Thanks,
Christof
2010 Oct 09
1
point characters THICKER in xyplot()
Hi, how can I make the point characters thicker (NOT larger) in xyplot when
groups= argument is used?
dat<-data.frame(x=1:100,y=1:100,group=rep(LETTERS[1:5],each=20))
### lwd=2 doesn't work here
xyplot(y~x,groups=group,data=dat,col=1:4,pch=1:4,lwd=2)
### lwd=2 works with panel.points(), but grouping is messed up!
xyplot(y~x,groups=group,data=dat,col=1:4,pch=1:4,
2005 Jul 25
1
order of panels in xyplot
I'm having trouble with the order of the panels using xyplot. I had used this bit of code before and received the desired plot (the code was not identical, but very similar; perhaps more importantly I was working with an older version of R) . Now the panels appear right to left instead of left to right, as it says in the help files, which is what I would like. Does anyone know if this has
2004 Feb 05
2
xyplot (lattice): colours of lines
using either one of the following codes:
xyplot(X ~ time | center, type="l", panel=panel.superpose, groups=subject,
col = treatment)
xyplot(X ~ time | center, groups = subject,
panel = function(x, y, ...){
panel.superpose(x, y, col = treatment, type = "l", ...)
})
I get two different colours for the lines by these colours do not match the
corresponding
treatment
2002 Nov 21
1
more than one level of grouping in xyplot
Dear listers,
Let use say that I want to display the Pixel dataset (in the NLME library)
xyplot(pixel~day|Dog, groups=Side, data=Pixel, panel=panel.superpose, panel.groups=panel.xyplot, type="b", pch=16)
(I know, there are better examples, ...)
Now, how could I change the colours of the symbols accordingly to another factor changing within subject and side form time to time? (let us
2003 Jul 17
2
line colors in lattice.xyplot with png device.
Hi,
R is very new for me, so excuse if my questions are too basic...
BTW, are there any forum where new R users could get help without
annoying this huge mailing list ?
In following code, I'd like to choose the color for each of the curve
diplayed.
png(filename = filename, width = 950, height = 600, pointsize = 10, bg =
"white")
xyplot(HITS+MS1*3+FREQ~TIME
2008 Aug 08
1
Lattice: regression lines within grouped xyplot panels
Dear community,
I am looking for a possibility to draw 'regression lines' instead of
'smooth' lines in grouped xyplots. The following code should give you a
small example of the data structure.
library(lattice)
data(Gcsemv, package = "mlmRev")
# Creates artificial grouping variable ...
Gcsemv$Groups <-
ifelse(as.numeric(as.character(Gcsemv$school))>65000,
2012 Oct 02
3
lattice xyplot, get current level
Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
How I get the current
2004 Jan 14
1
Trellis graph and two colors display
Hello,
I would like to display two groups of dots in different colors or style and additionnaly a linear regression for all the dots in
panel plots of a Trellis graph. Actually to get in each panel the equivalent of:
plot(x[mois==3],y[mois==3],col="blue")
points(x[mois==9],y[mois==9],col="red")
abline(lm(y~x), col="green")
"mois" being a grouping
2007 Jul 03
1
xyplot and autokey, maintaining colors specified via "col" in key
All,
When specifying colors to xyplot w/ a groups argument, using
auto.key no longer maintains the colors properly. I've searched
the docs and help but haven't found exactly what I need ... I saw
a few examples in the archives involving par.settings but that doesn't
seem to do it. I also saw some people using key instead of auto.key, but
that didn't seem consistent. Is there a
2006 Jul 04
1
coloring individual points in lattice xyplot
If I wish to color groups in xyplot I can do this:
library(lattice)
x <- 1:10
y <- cbind(x, x+1)
xyplot(y ~ rep(x,2), group = col(y), col = 1:2)
How do I color different points differently within a group.
For example, I want to produce this plot (except that I only
want to have two groups, not 11):
xyplot(y ~ rep(x,2), group = c(rep(1, 10), 2:11), col = 1:11)
I am
2005 Sep 17
4
xyplot and abline
Dear All,
I wonderif there is a simple way to draw a regression line in the xyplot:
more specifically, let:
age <- c(20:30, 31:40 )
age.cut <- cut(age, breaks = 2 )
y<- rnorm(20)
x <- rnorm(20,4,1)
xyplot(y ~ x| age.cut, xlab="x", ylab="y")
How to draw (in the plot given by xyplot) the two regression lines (y ~ x) corresponding to the two category
2010 Feb 14
2
xyplot, overlay two variables on one plot with group factors
All
I want to overlay two variables on the same plot following their appropriate
grouping. I have attempted to use subscripting in panel with panel.xyplot,
but I can't get the grouping to follow into the panel...here is an
example...
dat<-data.frame(
y= log(1:10),
y2=10:19,
x=1:10,
grp = as.factor(1)
)
dat2<-data.frame(
y= log(10:19),
y2= 20:29,
x=1:10,
grp = as.factor(c(2))
)
2005 Feb 10
1
xyplot() question
Dear R Users,
I have an xyplot() where different plotting symbols are used for
subgroups (originally used within S-Plus, but hopefully it?s also
applicable to R users).
How can I fit separate regression lines for every subgroup? So far, I
can only plot the overall fitted line.
The code looks like this:
trellis.device()
sps<-trellis.par.get("superpose.symbol")
sps$pch<-1:7
2010 Oct 17
1
lattice xyplot - formatting of multiple Y variables when using subgroups
Hi all,
Using xyplot I want to print to Y variables (y1, y2) versus X, conditional
on the group.
How can I obtain a line (type="l") for one relationship (ie. y1 ~ x) and
points (type="p") for the other (y2 ~ x) ?
library(lattice)
# create some sample data
df<-data.frame(group=as.factor(c(rep("a",4), rep("b",4))), # grouping
variable for conditional