Fine tune point in R-grid

I am trying to build a bunch of ROC areas for different data sets and different algorithms. I have three variables: “Scheme”, which defines the algorithm used, “Data set” - this is the data set on which the algorithm is tested, and “Area_under_ROC”.

I use the lattice library in R with the following command:

dotplot (Schema ~ Area_under_ROC | Dataset, data = simulationSummary, layout = c (4,6))

and this is what I get:

dotplot Schemas versus Area_under_ROC due to dataset

What I would like to know

  • How to make labels on the y-axis readable? Everyone is shrinking right now.
  • How can I reinstall the panel so that the datasets marked with the “100” sign make up the last column, but the remaining columns remain the same?

I am very grateful for any comments or pointers. Many thanks!

+4
source share
2 answers

Some ideas:

  • Use a smaller font size for the Y axis labels, for example. scale=list(y=list(cex=.6)) . An alternative would be to maintain a uniform font size, but a separate output on several pages (this can be controlled using layout= ) or, perhaps, it is better to show all the data from one data set (from A to F, therefore, 4 points for each algorithm) or size samples (from 10 to 100, therefore, 6 points for each algorithm) with the option group= . I personally would create two factors: sample.size and dataset.type for this.
  • Free your Dataset factor, so the dataset you are interested in appears where layout will place them, or (better!) Use index.cond to specify the specific layout for your 24 panels. For instance,

     dfrm <- data.frame(algo=gl(11, 1, 11*24, labels=paste("algo", 1:11, sep="")), type=gl(24, 11, 11*24, labels=paste("type", 1:24, sep="")), roc=runif(11*24)) p <- dotplot(algo ~ roc | type, dfrm, layout=c(4,6), scale=list(y=list(cex=.4))) 

    arrange the panels in a sequential order, from left to right ( type1 in the lower left panel, type24 in the upper right panel), and

     update(p, index.cond=list(24:1)) 

    arranges panels in reverse order. Just list with the expected panel locations.


Here is an example of what I mean with Point 1, and the use of two factors instead of one. Let's create another artificial dataset:

 dfrm <- data.frame(algo=gl(11, 1, 11*24, labels=paste("algo", 1:11, sep="")), dataset=gl(6, 11, 11*24, labels=LETTERS[1:6]), ssize=gl(4, 11*6, 11*24, labels=c(10,25,50,100)), roc=runif(11*24)) xtabs(~ dataset + ssize, dfrm) # to check allocation of factor levels dotplot(algo ~ roc | dataset, data=dfrm, group=ssize, type="l", auto.key=list(space="top", column=4, cex=.8, title="Sample size", cex.title=1, lines=TRUE, points=FALSE)) 

enter image description here

+9
source

In addition to chl answer, after separating the Dataset type into type and size, you can use useOuterStrips from the latticeExtra package.

To get more space for shortcuts, you can "transpose" the plot.

 # prepare data: simulationSummary$Dataset_type <- substr(simulationSummary$Dataset, 1, 5) simulationSummary$Dataset_size <- substr(simulationSummary$Dataset, 6, 10) # to gets proper order force factor levels: simulationSummary$Dataset_size <- factor(simulationSummary$Dataset_size, levels = c("10", "25", "50", "100")) library(latticeExtra) useOuterStrips(dotplot( Scheme ~ Area_under_ROC | Dataset_type*Dataset_size, data = simulationSummary, layout = c(4,6) )) 

Dotplot

Or use a vertical dot:

 useOuterStrips(dotplot( Area_under_ROC ~ Scheme | Dataset_size*Dataset_type, data = simulationSummary, horizontal=FALSE, layout = c(4,6), scales=list(x=list(rot=90)) )) 

enter image description here

+5
source

Source: https://habr.com/ru/post/1401299/


All Articles