2015-03-27 7 views
8

Quello che mi piacerebbe è rimuovere quelle etichette sul lato destro, quelle sulle scatole grigie sul lato. Faccio un esempio:Sbarazzarsi delle etichette facet_grid su quelle scatole grigie?

p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point() 
p + facet_grid(cyl ~ .) 

enter image description here

Grazie in anticipo!

Juan

+0

Eventuali duplicati di http://stackoverflow.com/questions/10547487/ r-removal-facet-wrap-labels-completamente-in-ggplot2 –

risposta

18

Di seguito l'avrebbe fatto:

p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point() 
p <- p + facet_grid(cyl ~ .) 
p <- p +theme(strip.text.y = element_blank()) 

Senza rettangoli

p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point() 
p <- p + facet_grid(cyl ~ .) 
p <- p + theme(strip.background = element_blank(), 
    strip.text.y = element_blank()) 

enter image description here

+3

Forse come quello S? 'ggplot (mtcars, aes (mpg, wt, col = factor (cyl))) + geom_point() + facet_grid (cyl ~.) + theme (strip.text.y = element_blank(), strip.background = element_blank()) ' –

+0

Questo è un buon puntatore, tuttavia ci sono ancora rettangoli grigi sul lato, un modo per cancellarli? – Juan

+0

Bello uno @FredrikKarlsson! Questo è definitivamente. – Juan