Questions tagged [lattice]

lattice is a package that forms part of base R and allows the creation of trellis-type graphics.

R's lattice package, developed by Deepayan Sarkar, is a port of Bell Laboratories' Trellis Graphics to R. It is one of the three main graphics options in R, the other two being R's base graphics capabilities and .

Repositories

Vignettes

Books

Other resources

R packages extending lattice

  • latticeDensity: Density estimation and nonparametric regression on irregular regions.
  • latticeExtra: Extra Graphical Utilities Based on Lattice.
  • latticist: A graphical user interface for exploratory visualisation.
  • latticedl: Lattice direct labels, for automatically labeling points.

Related tags

1251 questions
0
votes
1 answer

Trying to plot temperature and count data on same plot using xyplot?

I am using the xyplot in lattice trying to make a plot that shows temperature change over time in correlation with count data. I am not sure if ggplot2 would be better? My data is arrange like this: Year (1998 1998 1999 2000 2001 2001 2002) Low…
0
votes
1 answer

R lattice histogram add the mean as text to each histogram

According to the previous questions answered I thought the following script should work. require(lattice) histogram(cyl~mpg|gear*am, data=mtcars, nint=5, panel=function(y,...){ panel.histogram(...) …
Markm0705
  • 1,340
  • 1
  • 13
  • 31
0
votes
1 answer

lattice: overlay density plot with parameters in histogram

The following four calls return what seems to be the exact same graph. How can I control the panel density plot? Thank you. library(lattice) df <- data.frame( y = runif(100) , p = rep(c('a','b'),50) ) histogram(~ y | p , data = df , type…
user2105469
  • 1,413
  • 3
  • 20
  • 37
0
votes
1 answer

Combine multiple filled.contour plots with different levels of conditioning variables in R

I am currently looking at the response of simulated catchment flow to four climate variables: T, RH, Rs and uz. I would like to construct some 'response surfaces' for my flow to two of the variables, T and Rs, with different combinations of the…
0
votes
1 answer

Plotting gam model results in lattice

I am fitting a model using gam from the mgcv package. I am storing the result in model and so far I have been looking at the smooth components using plot(model). I have recently started using lattice and like its output. So I am wondering, is it…
user48386
  • 95
  • 1
  • 6
0
votes
2 answers

Change symbol colors in barchart legend

I have searched through this site and others and can't seem to find the problem in my code. I am trying to change the symbol colors in my barchart legend to correspond to the colors I specified when making the chart (using the lattice package). For…
user3605914
0
votes
1 answer

Multiple panel plot non-NA error

I've got a data frame that looks like this. a[,2:25] UT1 UT2 UT3 UT4 UT5 UT6 UT7 UT8 UT9 UT10 UT11 UT12 TR1 TR2 TR3 TR4 3094 9 0 1 37 6 2 8 1 1 6 3 1 3 0 0 1 3095 4 0 0 10 17 6 7 1 5 3 1 …
Matias Andina
  • 4,029
  • 4
  • 26
  • 58
0
votes
2 answers

How can I plot Facets in R using my data?

I have the following data for a US state d <- structure(list(Month = structure(c(5L, 4L, 9L, 1L, 8L, 7L, 6L, 2L, 12L, 11L, 10L, 3L), .Label = c("01-Abr-14", "01-Ago-14", "01-Dez-14", "01-Fev-14", "01-Jan-14", "01-Jul-14", "01-Jun-14",…
Geekuna Matata
  • 1,349
  • 5
  • 19
  • 38
0
votes
1 answer

lattice xyplot in R - how to plot multiple observations of same subject

I have a dataset which looks like the following and I want to plot it using lattice xyplot in R: ID = c("1","1","1","1","1","1","1","2","2","2","2","2","2","2","2","2","2","2","2","2","2") TIME = c("0", "0.5", "1","1.5","2","2.5","3","0","0",…
ykl
  • 397
  • 2
  • 3
  • 13
0
votes
1 answer

Ordering lattice bwplot

I am plotting data by week using a lattice bwplot and am having trouble figuring out how it is deciding to sort the plots for each day. It showing (left to right, top to bottom): Tuesday, Wednesday, Friday, Monday, Thursday. Rather, I want it to…
stokeinfo
  • 135
  • 1
  • 2
  • 8
0
votes
1 answer

How to add nls() fit with lattice

I have begun switching from base R graphics to lattice graphics. I now have some data and an nls() fit to that data, and am I'm trying to plot both onto a single graph. So, as a simple base R graphics code: require(lattice) # Data V <-…
Abstracted
  • 390
  • 3
  • 14
0
votes
1 answer

Combining lattice plots yields empty gaps on x-axis

I am trying to create a combined bar and xyplot using lattice where the x-axis is shared by both plots. require(lattice) require(latticeExtra) dd <- data.frame(Year = factor(1990:1999), Count = 0:9, Size = 9:0) p1 <- barchart(Count ~ Year, data =…
orizon
  • 3,159
  • 3
  • 25
  • 30
0
votes
1 answer

How do I reformat my data for ggplot?

I have four dataframes (say A,B,C and D). The data in each dataframe is of the format given below. But each dataframe is of a different length. lon lat area fd tp rt -85.40944 41.88833 274.5387…
Geekuna Matata
  • 1,349
  • 5
  • 19
  • 38
0
votes
1 answer

Changing axis text in wireframe to display date format

I am attempting to change the numeric values on the axis to strings of my choosing. The purpose is to replace numeric dates with '%m/%d/%y' format. library(lattice) #set up some simplified data x <- seq(41600, 41630, 1) y <- seq(0, 30, 1) #…
rrbest
  • 1,619
  • 3
  • 14
  • 22
0
votes
1 answer

Two-outcome dotplot by panel variable over several models (lattice dotplot in R)

I am trying to produce a dotplot over two variables (matched, unmatched) over several categories as below. The following code roughly does what I want (using dummy data): library(lattice) # Generate dummy data that resembles my real data dp0 <-…
rjturn
  • 323
  • 2
  • 8