Displaying 20 results from an estimated 40000 matches similar to: "Lattice in a loop does not produce output"
2009 Aug 11
3
Lattice: How to do error bars
I am trying to add 2 stdev error bars to lattice type plots:
panel.ebar<-function(x,y,dy=NULL,...) {
panel.xyplot(x,y,...)
panel.segments(x,y-dy,x,y+dy,...)
}
Then:
xyplot(y~x|fc,data=dat,dy=dat$dy,panel=panel.ebar)
This adds error bars but they are not conditioned on the factor fc.
xyplot(y+I(y-dy)+I(y+dy)~x|fc,data=dat)
This produces 3 series of points in different colors, conditioned
2004 May 07
1
Lattice xyplot - problem trying to produce multiple output files with a 'for' loop
I am stuck on trying to get the Lattice xyplot to output a separate PNG file each time through my 'for' loop. The files get produced but are empty.
Here is the code. I'm running 1.9 on Windows. BTW is there a more efficient way of creating the separate output files than looping over the levels and subsetting?
.........................................................
lev <-
2012 Oct 30
1
Is there an lm() equivalent of panel.lmline()?
panel.lmline returns intercept and slope of y ~ x subsetted to the
combination of conditioning factors given to xyplot in lattice.
for instance:
xyplot(Xvalues ~ log(Qvalues)|Tfac, data = df7, panel = panel.lmline)
I am looking to find the equivalent formulation for lm() proper. If I do
this:
lmcal <- lm(Xvalues ~ log(Qvalues):Tfac, data = df7)
Only one value of the intercept is returned.
2003 May 08
3
again troubles with lattice
Dear r-help community,
Thank you for your previous answers!
Now I have strange behaviour of the lattice library funcitons.
They do not draw graphics in the file when called from the script.
I created the script file, called, for example, "a.R", containing
the following
library(lattice);
trellis.device(device="png",
filename="a.png",
2009 Apr 28
2
Dropping 'empty' panels from lattice
I have 8 cofactors possibly affecting one and only one variable.
I make conditional histograms:
<-pdf(file="tst3.pdf",paper="special",width=36,height=36)
<-histogram(~Oversized|dat$c1*dat$c2*dat$c5*dat$c6*dat$c7*dat$c8*dat$c9*dat$c10,nint=21,layout=c(32,8),data=dat,type="count")
<-dev.off()
This works (compliments to R developers!) but it does generate a
2004 Apr 13
1
lattice problem in R-1.9.0
Hi all,
I just installed R-1.9.0 on Windows 2000 from binaries. Yesterday, on
R-1.8.1 I ran a script that looked like:
library(lattice)
tmp <- expand.grid(A = 1:3, B = letters[1:2])
tmp$z <- runif(NROW(tmp))
trellis.device(png, file = "x1081.png", theme = col.whitebg)
xyplot(z ~ A | B, data = tmp,
panel = function(x, y, i) {
panel.xyplot(x, y)
2003 May 06
5
xyplot (lattice), strip.default
Dear r-help,
I've got data of the following structure
1979 93.428747 0
1979 87.298608 20
1979 78.506340 40
...
1979 45.567890 340
1980 60.815289 0
1980 49.630904 20
1980 24.981362 40
...
The first column is year and the last one is the longitude.
I need a set of graphs showing the dependence of the middle value on
the longitude, for each year, situated one blow the other.
2006 Dec 28
2
lattice xyplot: plot multiple lines with different colors
Hi everyone,
I am using the lattice package to plot some simulation results, by using
the function xyplot(). However, I cannot find a way to plot multiple
lines within the same xyplot and to have each of the lines be drawn in a
different color.
This is what I am currently doing:
xyplot(a + b + c ~ x, my_data, panel = panel.lines)
but, of course, all lines are drawn in the same color.
What
2009 May 22
2
Returning only a file path on Windows
I am choosing a file like this:
#Bring up file selection box
fn<-file.choose()
fp<-file.path(fn,fsep='\\')
Unfortunately, the file path contains the short file name and extension as
well. I had hoped to get only the path so I could make my own long
filenames (for output graphs) by concatenation with this file path.
Of course I can split the string and assemble the components from
2009 Jan 16
1
XYplot in Lattice Package
Dear R-Users
I have 2 questions to do with XYplot.
1)
I am trying to use the XYplot function to generate multiple line graphs with
the legend outside the plot.
I am using the following loop for each graph:
library(lattice)
for (i in x.sp){
xyplot(Catch~Year, df, groups = Stock, type="a",auto.key =
list(space = "top", points = FALSE, lines = TRUE,columns = 4))
}
2005 Mar 15
2
How to plot points as numbers/strings in lattice
Hello,
I would be very grateful if anyone could help with what seems like a
simple lattice task. I want to use xyplot, where the symbols for the
plotted points are taken from another column in the data frame. So if the
data frame looked like:
a <- as.data.frame(matrix(data=c(1,1,10,2,2,20,3,3,30), nrow=3, ncol=3, byrow=TRUE))
a
V1 V2 V3
1 1 1 10
2 2 2 20
3 3 3 30
you would get
2009 Aug 18
1
second y-axis in lattice xyplot
Dear R-help,
I recently discovered lattice xyplot, but have been struggling with plotting a second y-axis. I am able to do this with plot() but can't figure it out in xyplot. Any help would be appreciated.
I have found help on adding a second Y-axis when the data is all part of the same data frame, but I have two different data frames.
Both data sets are being plotted against "Date".
2010 Jan 02
2
xyplot: problems with column names & legend
Hello!
one more question about xyplot. If I have data which have space in the
column names, say "xyz 123". How do I create a working graph where
this text is displayed in the legend key?
Now when I try something like xyplot("xyz 123" ~ variable1, data =
mydata, .......) I get nothing.
Also, is it possible to genrate the graph with xyplot(mydata[,1] ~
variable1, data = mydata,
2002 Jan 09
3
lattice problems under Win2K and R-1.4.0
I'm having problems copying and saving lattice graphs using R-1.4.0 under
Win2k. It seems I've see this alluded to recently in R-help.
If I do the following example:
> data(quakes)
> xyplot(long ~ lat , data = quakes)
And then try to copy or save the graph as either a metafile or bitmap or if
I use any of the bitmap/metafile devices via (for example)
>
2012 Mar 28
1
xyplot lattice fine control of axes limits and thick marks (with log scale)
After a long and winding road (sorry but I'm a novice) I get to a final
result which is quite close to what I need;
nevertheless I would like to tweak a little further the xyplot so that I can
get ***for each single panel defined by variable z*** a finer control over:
-the x and y the limits: I would like to be the same for both axes;
-the number of thick marks: again I would like to be same
2011 Jul 28
2
not working yet: Re: lattice overlay
Hi Dieter and R community:
I tried both of these three versions with ylim as suggested, none work: I
am getting only single (pch = 16) not overlayed (pch =3) everytime.
*vs 1*
require(lattice)
xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
panel= function(x, y, subscripts) {
panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
panel.lmline(x, y, lty=4, col =
2013 Feb 08
3
Border width on symbols plotted with the lattice package
Dear list members,
I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice'
package to respect the 'lwd' value for specifying the border with for
*symbols* (for lines it works fine). Example:
-----
# Base graphics works fine (gives a 'fat? circle)
plot(5, cex=10, pch=21, lwd=10)
# But 'xyplot' or 'dotplot' doesn't
2002 Mar 05
2
identify in lattice
Does identify work in lattice plots? I tried this in R 1.4.1 (original
release) on my Win2000 machine with lattice 0.4-0 and grid 0.5-1.
> xyplot(y ~ x,
+ panel=function(x, y, ...){
+ panel.xyplot(x, y, col=2, pch=20, ...)
+ panel.lmline(x, y, type = "l")
+ identify(x, y)
+ })
I get a change of cursor after the data points and the LS line are plotted
2010 Aug 21
1
lattice::xyplot() with one factor for points and another for lines
Hi:
In lattice, how does one handle separate graphical behavior for two
different factors? In the xyplot below, the objective is to use the levels
of one factor to distinguish corresponding shapes and colors, and the levels
of the other factor to perform level-wise loess smooths.
# Illustrative data:
d <- data.frame(time = rep(1:8, each = 6), val = rnorm(48),
gp1 =
2012 Jan 13
1
plotting regression line in with lattice
#Dear All,
#I'm having a bit of a trouble here, please help me...
#I have this data
set.seed(4)
mydata <- data.frame(var = rnorm(100),
temp = rnorm(100),
subj = as.factor(rep(c(1:10),5)),
trt = rep(c("A","B"), 50))
#and this model that fits them
lm <- lm(var ~ temp * subj, data = mydata)
#i want to