Displaying 20 results from an estimated 20000 matches similar to: "Overlapping plot in lattice"
2011 Jan 16
2
xyplot: modify axis tick marks
Hi,
I would like to plot time against rainfall data (data is at the end)
using xyplot.
The basic code looks like this: xyplot(rainfall~time, type="a")
When I do this, the graph looks ok except that the x-axis has too many
values. I would just like to display the years and not the months on
the x-axis. I've been fiddling around with 'scales', and read previous
posts about
2011 Oct 08
2
Connecting points over missing observations in Lattice
Hello,
I'm trying to plot connected time series of two variables in a lattice plot:
xyplot(y1 + y2 ~ t, data=size, type="b")
y2 has missing data for some of the observations and some points are
therefore not connected. It would make theoretical sense to connect the
points - is there a way of doing that? (Without filling the obserations
using package 'zoo').
Thanks,
2011 Apr 19
1
Define ylim in lattice plot based upon panel function output
Dear R-users,
By default, the xyplot function automatically defines the axis ranges based
upon the content of y and x variables. However, when one includes some calls
to other panel.<something> functions in the panel argument, the results
might be out of range and not show up in the final graphs (see lower ends of
the loess line in the following example). Is there a way one can capture the
2006 Jul 19
2
trellis.focus with postscript device
Hello.
First: R 2.3.1 on Windows XP.
I am trying to add information (sample size) to the Trellis strips which
I am successful using the trellis.focus function with the default
Windows device. However, I typically use the postscript device as I use
LaTeX and \includegraphic for incorporating graphs into stat reviews.
Here's some example code (apologies for the lack of creativity and
2012 Apr 07
6
Drawing a line in xyplot
i am trying to replicate the following graph using xyplot :
attach(x)
plot ( jitter(type), mortality, pch=16, xlim = c(0.25, 3.75))
lines ( c(1-0.375,1.375) , c ( median(mortality[type==1]),
median(mortality[type==1])), lwd=5,col=2)
lines ( c(2-0.375,2.375) , c ( median(mortality[type==2]),
median(mortality[type==2])), lwd=5,col=2)
lines ( c(3-0.375,3.375) , c ( median(mortality[type==3]),
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 =
2006 Sep 29
1
Plotting text with lattice
Hello,
I've decided to take the leap and try my hand at the lattice package,
though I am getting stuck at what one might consider a trivial problem,
plotting text at a point in a graph. Apologies in advance if (that) I'm
missing something extremely basic.
Consider in base graphics:
> plot(1:10)
> text(2, 4, "Text")
In the above you will see text centered at the point (2,
2009 Jan 21
1
Text Outside Lattice Plot
Dear R users
I created the graph at the bottom using xyplot in the lattice package. I
added a title using the main="Title" command in xyplot, however it is
plotted too close to the legend for my liking. To remedy this I increased
the upper margin of the plot using plot(data, position = c(0,0,1,.9)) and
attempted to move "SNA" upwards and to the right. I have tried using a
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 Feb 05
2
dynamically add items to key of lattice xyplot
Hi all,
is it possible to dynamically add key items to an already existing key,
belonging to a lattice xyplot?
This is what I do: I make an xyplot with an initial key. Later on, I
want to extend this key with more items, as more lines are added to the
plot (lines are added using trellis.focus("panel")).
I guess I need some function to access the key panel in order to extend
it,
2011 Jan 10
3
Lattice, combine histogram and line graph
Hello everyone,
I have a simple histogram of gasoline prices going back a few years that
I want to insert a line graph of consumer price index (cpi) over the
histogram. I have looked through the "Lattice" book by Deepayan Sarkar
but don't see anything there. How might this be done? An example would
be wonderful.
Current code snippet follows. For example additional field to add
2010 Nov 06
1
Prettier axis labels when using log scales in Lattice
Hello,
I am trying to alter the way in which lattice functions (specifically xyplot) print the axis labels when one uses the 'scales' parameter.
I can obtain the effect I want by using
scales=list(y=list(log=10, labels=expression(yvalues)))
where yvalues are the values that would have been printed as the y-axis labels if the "labels" argument had not been present. To help
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,
2009 Nov 23
3
Trellis Plot
anyone know how to add text in the Trellis plot panel ?? i want to add things
eg: dot dot dot. in the headrer of the panel.
eg: http://old.nabble.com/file/p26486579/hist1.png hist1.png
--
View this message in context: http://old.nabble.com/Trellis-Plot-tp26486579p26486579.html
Sent from the R help mailing list archive at Nabble.com.
2010 Dec 17
2
adding text to the top corner of a lattice plot
Hi, I have a series of lattice plots which I am arranging in a 2x2
grid via print:
print(p.preds, split=c(1,1, 2,2), more=TRUE)
print(p.comp, split=c(2,1,2,2), more=TRUE)
print(p.bw, split=c(1,2,2,2), more=FALSE)
What I'd like to have is a letter (A, B, ...) in the top corner of
each plot. While panel.text lets me add text anywhere within a plot, I
can't seem to workout how I could put
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
2002 Mar 19
3
plot with the axes at xlim and ylim
I'd like to make a plot with the axes drawn at the values of xlim and
ylim. The default plot draws the axes slightly outside these values. I
have been experimenting with the par(mgp) setting, but specifying
par(mgp=c(2,0,-1)) gives me
"invalid value specified for graphics parameter "mgp".".
A more complicated mathod that almost seems to work is doing the plot
with
2006 Jul 29
3
placing rectangle behind plot
I am trying to create a lattice plot and would like to later, i.e. after
the plot is drawn, add a grey rectangle behind a portion of it.
The following works except that the rectrangle is on top of and
obscures a portion of the chart. I also tried adding col = "transparent"
to the gpar list but that did not help -- I am on windows and
perhaps the windows device does not support
2011 Mar 10
3
lattice xscale.components: different ticks on top/bottom axis
Good afternoon,
I am trying to create a plot where the bottom and top axes have the same
scale but different tick marks. I tried user-defined xscale.component
function but it does not produce desired results. Can anybody suggest
where my use of xscale.component function is incorrect?
For example, the code below tries to create a plot where horizontal axes
limits are c(0,10), top axis has ticks
2006 Aug 29
2
lattice and several groups
Dear R-list,
I would like to use the lattice library to show several groups on
the same graph. Here's my example :
## the data
f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3"))
f1 <- rep(f1,3)
f2 <-