lattice

How can I sort random effects by value of the random effect (not the intercept) in dotplot or ggplot2

烂漫一生 提交于 2019-12-21 19:57:10
问题 I suspect the answer to this question is rather simple and I just don't know what it is. Long story short, I want to display a dotplot of the random intercepts and slopes from a model I am estimating. I'm using the ggCaterpillar function helpfully introduced here. However, this function, as well as the standard dotplot from lattice, sort the ensuing graph by decreasing order of the random intercept. I would like to sort the graph by increasing value of the random effect (either alphabetical

Can't add a probability-curve on the histogram

会有一股神秘感。 提交于 2019-12-21 05:50:14
问题 I'm trying do display multiple histograms with one plot with the lattice-package. That's my code so far: histogram(~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10, data=mydata, type = "density",layout=c(5,2), panel=function(x, ...) { panel.histogram(x, ...) panel.mathdensity(dmath=dnorm, col="black", args=list(mean=mean(x), sd=sd(x)), ...) }) The problem is, that it won't plot the probability-curve. It doesn't give me an error back, so the code looks good, I think. I also tried it with

Levelplot color key - range and extremes

隐身守侯 提交于 2019-12-21 05:16:10
问题 Is it possible in R to create a color key like the one below? (this one comes from the software Grid Analysis and Display System - Grads). There are two features that I can't reproduce in R: The sequence is non linear however it is displayed as if Values bigger than 200 are grey / Values smaller than 0 are white I'm using levelplot from rastervis that plots rasters using the lattice levelplot: require(raster) require(rasterVis) set.seed(200) X = seq(-40,0,by=1) Y = seq(-60,-40,by=1) grid =

Add labels on lattice xyplot

两盒软妹~` 提交于 2019-12-21 05:09:19
问题 I have created a xyplot with lattice library(lattice) X1=c(5, -2, 1, -3) X2=X1^2 names=paste("dot", 1:4, sep="") xyplot(X2~X1, data=data.frame(X1, X2), pch=20, cex=1:4) Now I want to add a label (text) for each dot. The info is in names=paste("dot", 1:4, sep="") I have tried with no success the following panel.text(x=X2, y=X1, names) or, using directlabels library(directlabels) p=xyplot(X2~X1,data=data.frame(X1, X2), pch=20, group=names, cex=1:4) direct.label(p,smart.grid,FALSE) but I don't

How do I specify different color ranges for different levels?

和自甴很熟 提交于 2019-12-20 19:47:15
问题 I am making a lattice levelplot from x and y factors that range from [0,1]: x y level 1 m3134 m3134 1.0000000 2 m3134 m416B 0.4189057 3 m416B m3134 0.2696508 4 m3134 mA20 0.3322170 5 mA20 m3134 0.2454191 6 m3134 mB 0.3176792 ... Here is the R script that I use to make the figure from this data: #!/foo/bar/bin/Rscript --vanilla args <- commandArgs(TRUE) mtxFn <- args[1] pdfFn <- args[2] mtx <- read.table(mtxFn, col.names=c("x", "y", "level")) mtx$level[(mtx$level == 1)] <- NA library(lattice)

changing layout of boxplot and adding labels to it

一笑奈何 提交于 2019-12-20 09:47:26
问题 I want to (got suggestion to do so) create boxplot with different look and added labels to it. The expected (not complete) output will look like the following (with every box has quatile labeles) and sample size. boxplot(len~supp*dose, data=ToothGrowth, notch=TRUE, col=(c("gold","darkgreen")), main="Tooth Growth", xlab="Suppliment and Dose", names = supp ) # some unsuccessful trials # to add names boxplot(len~supp*dose, data=ToothGrowth, notch=TRUE, col=(c("gold","darkgreen")), main="Tooth

Adding different vertical lines for each panel in xyplot using lattice in R

白昼怎懂夜的黑 提交于 2019-12-20 07:31:28
问题 I have a graph of plant species frequency by year for several sites that I am plotting using xyplot in the lattice package. I've figured out how to get the scatterplot for each species-site combo. However, I want to add an abline representing each year in which a chemical treatment was done. Chemical treatments were added in different years at each site, and I'd like to add a vertical abline for each species-site graph in which a chemical treatment was performed at that site. Here is my

assigning colours to plots in lattice according to Set or factor, not groups

孤人 提交于 2019-12-20 04:10:22
问题 I have a lattice plot of experimental data that has 4 datasets (i.e. 4 different subsets in "Config." below), each dataset subdivided according to the config and then also grouped within each test type according to wind direction, "Dir". I am able to set the shape of the points according to the grouping "Dir" across all plots but i cannot then set colours according to "Config" so that for example the first plot has all red points, the second plot has all blue points etc. I am using an xyplot

Color gradient for elevation data in a XYZ plot with R and Lattice

时间秒杀一切 提交于 2019-12-20 00:22:54
问题 I have a bunch of XYZ data where X and Y are coordinates and Z is supposed to be the elevation (LiDAR points). I am trying to plot this point cloud with a gradient based on the Z value. Here is what I have so far: # Read the CSV file with the LiDAR point cloud (which was conveniently converted to CSV) myData <- read.csv("./52I212_plot10.las.csv") # We don't need all attributes, let's keep only X, Y and Z. myData <- subset(myData, select=c(X,Y,Z)) # We want a normalized version of Z (between 0

Draw vertical ending of error bar line in dotplot

℡╲_俬逩灬. 提交于 2019-12-19 19:44:38
问题 I am drawing dotplot() using lattice or Dotplot() using Hmisc . When I use default parameters, I can plot error bars without small vertical endings --o-- but I would like to get |--o--| I know I can get |--o--| when I use centipede.plot() from plotrix or segplot() from latticeExtra , but those solutions don't give me such nice conditioning options as Dotplot() . I was trying to play with par.settings of plot.line , which works well for changing error bar line color, width, etc., but so far I