I am new to ggplot2 - until now I always used the R base plot functions. Anyway, I have some data that I was able to plot, but I'm not quite satisfied with the result yet. Here's some code to reproduce the plot:
library( ggplot2)
library( ggstance)
method <- rep( c( 'a', 'b', 'c', 'd', 'e', 'f'), 6)
scheme <- c( rep( 'sc1', 18), rep( 'sc2', 18))
classif <- runif( 36, min = 0.4, max = 0.6)
para <- c( rep( 0.1, 6), rep( 0.2, 6), rep( 0.3, 6), rep( 0.4, 6), rep( 0.5, 6), rep( 0.6, 6))
five <- runif( 36, max = .3)
ninetyfive <- runif( 36, min = .7)
avg <- ninetyfive - five
dat <- data.frame( method, scheme, classif, para, five, ninetyfive, avg)
dat[ c( 'para', 'method', 'scheme')] <- lapply( dat[ c( 'para', 'method', 'scheme')], FUN = as.factor)
ggplot( dat, aes( x = classif, y = method)) +
labs( x = 'Number of features', y = 'method') +
geom_point() +
geom_errorbarh( aes( xmin = five, xmax = ninetyfive)) +
facet_wrap( vars( para, scheme))
The result looks like this:
I want to amend two things:
First, and most important, I want to add the avg
column to my plot with a different symbol/colour.
Second, I'd love to amend the text in each of those boxes ( the ones that contain 0.1, 0.2, ..., 0.6) and I would also like to change the text sc1 and sc2 to something different - but I don't want to change it in the data-frame. Any ideas?