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

Using levelplot as a substitute for filled.contour - how to assign z values efficiently

I want to plot a level plot of a function as a heat map, and I am not sure if I am initializing the grid for the plot in the most efficient way. Currently, I am working with the code below and I am wondering if grid$z<-…
Roland
  • 517
  • 8
  • 25
0
votes
1 answer

Add error bars separately in lattice line-plot?

I have a line-plot produced with lattice's xyplot. It contains two types of temperatures measured, one of these are mean values. Therefore, I would like to add standard errors to these points (t.tort). Unfortunately, doing this separately does not…
user2696652
0
votes
2 answers

Controlling zlim values for contourplot

I am having a problem with 'lattice' graphics contour plots. I have been trying to create a contourplot using the code below, and am running into an issue with the display ranges. Basically, the contourpplot function uses the ranges for my…
0
votes
1 answer

Color Legend for 'contourplot' (Lattice) exceeds display values - R

I have a question in relation to 'lattice' graphics contour plots. I have been trying to create a contourplot using the code below, and am running into an issue with the display ranges. Basically, the contourpplot function uses the ranges for my…
0
votes
1 answer

Using panel.mathdensity and panel.densityplot in lattice graphics to plot Bayesian prior and posterior

I am trying to plot a Bayesian prior and posterior distribution using lattice graphics. I would like to have both distributions in one panel, for direct comparison. I've tried different solutions all day, including qqmath but I didn't get them to…
Gerome Bochmann
  • 496
  • 6
  • 19
0
votes
1 answer

Name data set as variable in R/Lattice

Is the filename of the current data set used in Lattice (e.g. in xyplot()) available as a variable name ? I want to include the data set name as a footnote to the graph and write a generic function that takes the name. Thanks
0
votes
1 answer

Plot ratios as correlation matrix in R

This question is similar to me as this SO post. Sample data for the ratios: n=50 ratio1 <- seq(0,1.5,(1.5-0)/(n-1)) ratio2 <- seq(0,2.5,(2.5-0)/(n-1)) ratio3 <- seq(0.5,4.5,(4.5-0.5)/(n-1)) ratio4 <- seq(1,3,(3-1)/(n-1)) ratio5 <-…
Maximilian
  • 4,177
  • 7
  • 46
  • 85
0
votes
0 answers

Colour lattice wireframe from class formula by z data heights

Edit: I've discovered one solution, which is to transform the 2d Temp matrix into a 1D array, re-running the code with just this matrix gave me the output I wanted i.e. plot coloured by height of z data. The code is…
0
votes
1 answer

xyplot panel function overriding group colours

I have the following chunk of script for creating a scatter plot with an lm line and an lm line through the origin: xyplot(nbsp~FRic, groups = Ecoregion,data=dataplot, xlab="Functional Richness", ylab="Species Richness", panel=function(x, y,…
KatMartin
  • 1
  • 1
0
votes
1 answer

R + xyplot + key with multiple references

I have a plot that is similar to this: w=rnorm(9) z=rnorm(9) A=as.factor(c(rep(c("A1","A2","A3"),3))) B=as.factor(c(rep("B1",3),rep("B2",3),rep("B3",3))) C=as.factor(c("C1","C1","C2","C2","C3","C3","C1","C2","C3")) xyplot(w~z,type="p",cex=1.4, …
MMP
  • 63
  • 6
0
votes
2 answers

Add stripplot points to bwplot (Lattice graphics in R)

##Example data to illustrate problem: type=c("grp1","grp2","grp1","grp3","grp3","grp3","grp4") num=c(1,1,2,4,3,5,1) cols=c(rep("red",5),"green","red") library(lattice) bwplot(num~type) par(new=T) stripplot(num~type,col=cols) I like the additional…
Jessica B
  • 321
  • 1
  • 4
  • 15
0
votes
1 answer

perspective plot in R (tick marks and understanding what is going on)

I plot a 3d plot in R using persp. I have two questions with respect to this: Want to verify that I understand the docs correctly. persp will take the valuex from x and y, then depending on the index of each value in those vectors, say (i,j)…
Alex
  • 19,533
  • 37
  • 126
  • 195
0
votes
1 answer

Drawing last observation in different colour and shape lattice R

I would like to plot last observation from my data.frame in different colour/shape. Now, one close entry about this topic is here at SO but not exactly what I need. This solution I'm posting here works, but I would be glad to have also other…
Maximilian
  • 4,177
  • 7
  • 46
  • 85
0
votes
2 answers

Why is y-axis wrapped in xyplot for longitudinal data?

I am doing a project on Functional Data Analysis, where I am trying to plot spaghetti plots for height. I am using xyplot from lattice library. Why is y-axis wrapped in xyplot? Here I am plotting data for only one individual. If plot whole data set…
Javas
  • 1
  • 1
0
votes
1 answer

Add legend inside each panel with Lattice in R

I wanna make a scatter plot with connecting lines for different groups and different individuals. I make panels conditioned by my group variable and groups conditioned by my individual variables. Now, I would like to add legend inside each…
datutu
  • 1
  • 1