Hi I am trying to use ggplot2 to do the following
1) Change the legend name to \"asset\" 2) Add a title to the top 3) Change the border of each panel to a more solid da
1) You can change the legend name to "Asset" by putting "Asset" as the first parameter in the scale_color_manual
function.
scale_colour_manual("Asset",values = ...)
2) You can do
p<-p+labs(title="PUT TITLE HERE")
for the title
3) You can add an additional argument to theme()
to change the background color (which will make a border appear around the box)
p<-p+theme(panel.background = element_rect(fill=NA, col="black"))
source: How to place divisions between facet grid lines
You could also try adding p=p+theme_bw()
earlier in the expression, but that might change too many things.
4) For the grid labels, you have 2 options (well, more, but these are the easiest). Firstly, you can rename the levels of your data. If you don't want to do that, you can make a labeller function to pass as an argument in facet_grid()
. See the example here:
https://stackoverflow.com/a/12104207/1362215
For the color of the panel, you can also use theme()
for that
p<-p+theme(strip.background = element_rect(fill = 'purple'))#turns boxes purple