Remove top and right border with ggplot2

Is it possible to remove the top and right border from ggplot2 graphs?

Ie, I would like to keep the x and y axes, but delete the rest of the black frame that surrounds the graph.

// M

+5
source share
2 answers

see this topic, here we are talking specifically about the problem here

http://groups.google.com/group/ggplot2/browse_thread/thread/f998d113638bf251

and gives a solution that seems to work.

+2
source

You can add this to your plot.

+ opts(panel.grid.minor = theme_blank()) 
+ opts(panel.grid.major = theme_blank()) 
+ opts(axis.line = theme_segment())

Starting with version 0.9.2, it has optsbeen replaced by theme:

+ theme(panel.grid.minor = element_blank()) 
+ theme(panel.grid.major = element_blank()) 
+ theme(axis.line = element_segment())
+3
source

All Articles