Luigi Marongiu
2017-Feb-22 09:03 UTC
[R] single strip for the same group in dotplot lattice
dear all, I have a set of data that is subdivided in cluster (run 1/run 2) and in target (A/B). When plotting, I obtain a panel strip with "run 1" and "run 2" for each "A" and "B" panel, so "run 1" appears twice and so does "run 2". It is possible to merge the strip together so that I will have "run 1" or "run 2" only once? this will reduce the complexity of the data and allow more space for more detailed information in the strip. the data follows, thank you L>>>cluster <- c(rep("run_1", 6), rep("run_2", 6)) type <- rep(c("blank", "positive", "negative"),2) target <- c(rep("A", 6), rep("B", 6)) value <- c(0.01, 1.1, 0.5, 0.02, 1.6, 0.8, 0.07, 1.4, 0.7, 0.03, 1.4, 0.4) my.data <- data.frame(cluster, type, target, value) library(lattice) dotplot( value ~ type|target + cluster, my.data, groups = type, pch=21, main = "Luminex analysis MTb humans", xlab = "Target", ylab = "Reading", col = c("grey", "green", "red"), par.settings = list(strip.background = list(col="paleturquoise")), scales = list(alternating = FALSE, x = list(labels = c("", "", ""))), key = list( space = "top", columns = 3, text = list(c("Blank", "Negative", "Positive"), col="black"), rectangles = list(col=c("grey", "green", "red")) ) ) [[alternative HTML version deleted]]
Hi Luigi, I'm afraid I don't understand your toy data as you've described it, but if you really don't have run 2 for target A, and don't have run 1 for target B, why not just create another factor that reflects this, and plot that? my.data$clus2 <- with(my.data, interaction(cluster, target)) and call: dotplot(value ~ type| clus2, ... ) Philip On 22/02/2017 8:03 PM, Luigi Marongiu wrote:> dear all, > I have a set of data that is subdivided in cluster (run 1/run 2) and in > target (A/B). When plotting, I obtain a panel strip with "run 1" and "run > 2" for each "A" and "B" panel, so "run 1" appears twice and so does "run > 2". It is possible to merge the strip together so that I will have "run 1" > or "run 2" only once? this will reduce the complexity of the data and allow > more space for more detailed information in the strip. > the data follows, > thank you > L > > cluster<- c(rep("run_1", 6), rep("run_2", 6)) > type<- rep(c("blank", "positive", "negative"),2) > target<- c(rep("A", 6), rep("B", 6)) > value<- c(0.01, 1.1, 0.5, > 0.02, 1.6, 0.8, > 0.07, 1.4, 0.7, > 0.03, 1.4, 0.4) > my.data<- data.frame(cluster, type, target, value) > > library(lattice) > dotplot( > value ~ type|target + cluster, > my.data, > groups = type, > pch=21, > main = "Luminex analysis MTb humans", > xlab = "Target", ylab = "Reading", > col = c("grey", "green", "red"), > par.settings = list(strip.background = list(col="paleturquoise")), > scales = list(alternating = FALSE, x = list(labels = c("", "", ""))), > key = list( > space = "top", > columns = 3, > text = list(c("Blank", "Negative", "Positive"), col="black"), > rectangles = list(col=c("grey", "green", "red")) > ) > ) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Luigi Marongiu
2017-Feb-22 10:25 UTC
[R] single strip for the same group in dotplot lattice
Dear Philip, the data is indeed a toy data: the real one will have 15 panels (=targets) and two or three clusters. this means that I will have 15 strips with the label "run 1" = "cluster 1" etc. the point of the toy data is that I get a 4x4 panel plot with 8 strips labelled "run 1", "run 2", "A" and "B". What I am looking for is to collapse the strips so to get only one label "run 1" and only one with "run 2" in order to simplify the plot. Hope this helps. Thanks Luigi On Wed, Feb 22, 2017 at 9:53 AM, P Tennant <philipt900 at iinet.net.au> wrote:> Hi Luigi, > > I'm afraid I don't understand your toy data as you've described it, but if > you really don't have run 2 for target A, and don't have run 1 for target > B, why not just create another factor that reflects this, and plot that? > > my.data$clus2 <- with(my.data, interaction(cluster, target)) > > and call: dotplot(value ~ type| clus2, ... ) > > > Philip > > > On 22/02/2017 8:03 PM, Luigi Marongiu wrote: > >> dear all, >> I have a set of data that is subdivided in cluster (run 1/run 2) and in >> target (A/B). When plotting, I obtain a panel strip with "run 1" and "run >> 2" for each "A" and "B" panel, so "run 1" appears twice and so does "run >> 2". It is possible to merge the strip together so that I will have "run 1" >> or "run 2" only once? this will reduce the complexity of the data and >> allow >> more space for more detailed information in the strip. >> the data follows, >> thank you >> L >> >> cluster<- c(rep("run_1", 6), rep("run_2", 6)) >> type<- rep(c("blank", "positive", "negative"),2) >> target<- c(rep("A", 6), rep("B", 6)) >> value<- c(0.01, 1.1, 0.5, >> 0.02, 1.6, 0.8, >> 0.07, 1.4, 0.7, >> 0.03, 1.4, 0.4) >> my.data<- data.frame(cluster, type, target, value) >> >> library(lattice) >> dotplot( >> value ~ type|target + cluster, >> my.data, >> groups = type, >> pch=21, >> main = "Luminex analysis MTb humans", >> xlab = "Target", ylab = "Reading", >> col = c("grey", "green", "red"), >> par.settings = list(strip.background = list(col="paleturquoise")), >> scales = list(alternating = FALSE, x = list(labels = c("", "", ""))), >> key = list( >> space = "top", >> columns = 3, >> text = list(c("Blank", "Negative", "Positive"), col="black"), >> rectangles = list(col=c("grey", "green", "red")) >> ) >> ) >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at 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/posti >> ng-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > >[[alternative HTML version deleted]]