Hello, I have drawn data from a dataframe as follows: ``` Substance = rep(c("A", "B", "C", "D"),4) Concentration = rep(1:4,4) Value = c(62.80666667, 116.26333333, 92.26000000, 9.87333333, 14.82333333, 92.37333333, 98.95666667, 1.48333333, 0.64666667, 50.66000000, 25.75333333, 0.69000000, 0.21666667, 7.40666667, 6.92000000, 0.06333333) df = data.frame(Substance, Concentration, Value, stringsAsFactors = FALSE) Value = c(15.2974126, 16.3196089, 57.4294280, 9.1943370, 20.5567321, 14.0874424, 38.3626672, 0.3780653, 0.4738495, 37.9124874, 16.2473916, 0.7218726, 0.2498666, 8.4537585, 10.8058456, 0.1096966) dfsd = data.frame(Substance, Concentration, Value, stringsAsFactors = FALSE) COLS = c("gold", "green", "purple", "blue")
plot(df$Value[df$Substance == "A"] ~ unique(df$Concentration), xlab=expression(bold(paste("Concentration (", mu, "M)"))), ylab=expression(bold("Value")), type = "o", col = "gold", pch = 16, xaxt="n", las=3, log = "x", ylim = c(0, max(df$Value+dfsd$Value)) ) points(df$Value[df$Substance == "B"] ~ unique(df$Concentration), type = "o", col = "green", pch = 16) points(df$Value[df$Substance == "C"] ~ unique(df$Concentration), type = "o", col = "purple", pch = 16) points(df$Value[df$Substance == "D"] ~ unique(df$Concentration), type = "o", col = "blue", pch = 16) legend("topright", legend = LETTERS[1:4], lty = 1, pch = 16, col = COLS) ``` I then tried to use lattice but I got a stripplot instead. At each x (1:4) only one group (A:D) is drawn. What am I missing? ``` library(lattice) xyplot(Value ~ Concentration, group = Substance, data = df, pch = 16, cex = 1.2, type = "b", xlab=expression(bold(paste("Concentration (", mu, "M)"))), ylab=expression(bold("Infection rate")), col=COLS, scales = list(x = list(log = 10, at=c(unique(df$Concentration)) ) ), key = list(space="top", columns=4, col = "black", points=list(pch=c(16, 16, 16, 16), col=COLS ), text=list(c("A", "B", "C", "D") ) ) ) ``` Thank you -- Best regards, Luigi ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.