Displaying 20 results from an estimated 30000 matches similar to: "dates with lattice graphics"
2009 Sep 19
3
reducing space between charts in lattice graphics
Hi,
I'm trying to create a lattice plot with three xyplots in one vertical
column. I would like to reduce the vertical space between the charts. My
code is below. There seems to be a "between" parameter for lattice.options,
but I can't find any examples. Aside from the data setup, the code is below.
Can anyone provide an example showing how to reduce the white space between
the
2011 Feb 19
1
problem in plotting numeric x by POSIXt class with lattice
# hi all,
# I'm trying to plot temperatures by date in a trellis plot by their
stations
# I'm plotting the following data.frame
library(lattice)
h <- structure(list(station_name = structure(c(3L, 4L, 2L, 10L, 11L,
12L, 6L, 7L, 5L, 8L, 9L, 3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L, 5L,
8L, 9L, 3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L), .Label = c("Ashqelon",
"Beer Sheva",
2009 Sep 24
1
superimposing xyplots on same scale
I have two xyplots that i want to superimpose (code below). By default they
are displayed on slightly different y scales (one runs from 10 to 25, the
other from 10 to 30). I would like to force them both onto the same scale
(10 to 30) so the relation between the two is clear. Is there a way to do
this?
thanks much
pct_compl_chart <- xyplot(pct_compl ~ date,
col="red",
2003 Oct 20
1
controling x-labels in xyplot (lattice) when x is POSIX object
Hi,
V1.8.0 seems to allow DateTimeClasses as the x argument in xyplots (lattice).
For example:
x <- seq.POSIXt(strptime("2003/01/01", format = "%Y/%m/%d"),
strptime("2003/10/01", format = "%Y/%m/%d"), by = "month")
y <- rnorm(length(x))
dat <- data.frame(x= x, y = y)
xyplot(y ~ x, data = dat, type = "b")
2010 Apr 16
6
bwplot puts the bars in the wrong place
Dear R-Help,
With the attached data set, I am still getting incorrect bwplots
> xyplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf) # Is correct
> bwplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf, horizontal=FALSE) #
Puts the boxes on the wrong x-axis values
# look especially at 0 and 3. How do I fix this?
What is happening?
Thanks,
Jim Rome
2007 Sep 11
1
POSIXct dates on x-axis using xyplot
I am using 'xyplot' in lattice to plot some data where the x-axis is a
POSIXct date. I have data which spans a 6 month period, but when I
plot it, only the last month is printed on the right hand side of the
axis. I would have expected that at least I would have a beginning
and an ending point so that I have a point of reference as to the time
that the data spans. Here is some test
2008 Feb 05
1
Inconsistent lattice scales$x$at,label behaviour for POSIXct
I have encountered the following behaviour in lattice in 2.6.1 (and
2.4.0) which differs depending upon the type you use. I believe the
numeric behaviour to be correct, and the POSIXct behaviour to be in
error.
When the x data and x axis in a lattice graph are POSIXct, and when
using scales$x$at and scales$x$labels to add custom labels:
If the first visible at value is not the first
2010 Feb 05
2
lattice barchart using a time scale in x axis
I'm trying to produce a barchart plot with groups, in which each group is placed in a particular
time scale in x-axis. If I use barchart directly it does not take the time scale. I've tried with
xyplot and adding a panel.barchart, I have the bars in the right place, but not the three groups I'm
trying to produce. I've tried defining panel and panel.group, but can't get it to
2004 Feb 04
5
Date Time Conversion problems...
At one time (version 1.7), the code below used to work for converting and
extracting based on the Date Time. In version 1.8.1, something changed I
know, but I cannot for the life of me figure out what...
Data:
UserName,RequestDate,PO,OrderDate,ExpDelivDate,Vendor,Total
"Woody, Jim",12/19/2002,AP15063,1/7/2003,2/10/2003,Ames ,8570
"Harrold,
2007 Jun 11
2
Overlaying lattice graphs
Hello
I apologize in advance if this question has already be posted on the
list, although I could not find a relevant thread in the archives.
I would like to overlay xyplots using different datasets for each plot.
I typically work on the following data.frame (mydata) structure
>mydata
Drug Time Observed Predicted
1 A 0.05 10
2011 Sep 13
2
Mathematical expressions in the group labels in lattice
Hi,
I am working with the lattice package and I want to label to groups in the xyplots with mathematical expressions.
I short example for this
library(lattice)
Case<-factor(rep(1:2,each=300))
xx<-rnorm(600,0,1)
yy<-rnorm(600,0,1)
xyplot(yy~xx|Case)
This results in two scatter plots with label "1" and "2". I would like to substitute this labels by math expression. I
2004 Jul 05
1
date Axes and formats in lattice plots
All,
I have some data of animal movements that I'm plotting using xyplot() from lattice. I want to have the date (class POSIXct object) on the Y-axis and the animals longitude on X-axis.
Eg.
xyplot(date ~ longitude, groups = animal, data = my.data)
with data like:
animal ptt year month day lon date
125 03P0014 13273 2003 7 10 150.38 2003-07-10 14:03:48
126
2005 Feb 09
1
Dates labels on axes in xyplot
I am a bit confused about how to get the format of the labels in xyplot
to show as dates rather than the numeric value.
e.g.,
x <- as.Date(c("20/01/2001","20/02/2003","21/06/2004"),"%d/%m/%Y")
y <- c(1,2,3)
plot(y~x) #produces formatted labels
xyplot(y~x) #doesn't give formatted x labels
2007 Mar 29
2
error in lattice formattedTicksAndLabels.Date (PR#9590)
Full_Name: James Szinger
Version: 2.4.1
OS: linux and MacOS X
Submission from: (NULL) (128.165.24.206)
I'm trying to plot some data from the past 12 months and the lattice package is
not labeling the time axis correctly. It shows only two labels instead of the
expected 12. The base graphics get it right.
I think the problem is the commented-out line in formattedTicksAndLabels.Date in
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,
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,
2009 Jul 09
2
Lattice xyplot: same scales within one factor
I am using R 2.8.1 and lattice to produce xyplots conditioned on
two factors. What I would like is to have the scales be free between values
of one factor, but some within. Thus, in the example:
xyplot(mpg ~ disp | factor(gear) + factor(cyl), mtcars,
scales=list(x=list(relation="free")))
rather than having the x scales be free within a gear as well, I want it to
be the same for
2011 May 14
2
changing the day of the week in dates format
Dear all,
I have a question related to the POSIXlt function in R.
I have a set of dates and times, for exmaple:
startx <- as.POSIXct("2011-01-01 00:00:00")
finx <- as.POSIXct("2011-12-31 00:00:00")
daysx<- seq(startx, finx, by="24 hours")
I
want to change the dates of all the days falling on a Saturday to the
next working day (i.e. Monday). So I
2005 May 13
2
Lattice plot within a "for" loop does not happen?
I am trying to do a series of xyplots plots, using a "for" loop to
substitute the appropriate variables for each plot. The basic command
works fine by itself and produces a nice plot:
> i<-3
> trellis.device(theme="col.whitebg")
> xyplot(as.formula(paste(tmp00[2*i], "~ ", tmp00[(2*i)-1],
+
2008 Aug 26
2
lattice plotting character woes
The following reproducable code shows the setting of my problem:
set.seed(260808)
n = 50
x = rnorm(n)
y = rnorm(n)
z = ceiling(runif(n,0,4))
g = runif(n,0,6)
G = factor(ceiling(g))
xyplot(y ~ x | G)
plsy <- trellis.par.get("plot.symbol")
plsy$pch = z
trellis.par.set("plot.symbol",plsy)
xyplot(y ~ x | G)
plsy$pch = as.character(z)