Suppose I have the data and plot as follows:
mydata = data.frame(x=rnorm(4), y=runif(4), tau=c(0,0,1,1))
ggplot(mydata) + geom_point(aes(x=x, y=y)) + facet_wrap(~ tau)
I would like the facet labels to read "tau=0" and "tau=1", respectively, with tau formatted as its greek symbol. I know from another question that using the labeller label_parsed
will format the letter tau by itself, but the equal sign seems to complicate things. An ideal solution would not require me to change the data (i.e. make tau a factor and name its levels), but I will take whatever works :)
here a solution with
facet_grid
adn indexing the tau by its levels.Edit To get the "tau=0" and "tau=1"
Edit2 second variable sigma
I find this solution, by defining a custom labeller. Hope someone ( ggplot2 guys ) give me a simpler solution.
There is an easier solution to this. The simulated data variable names have been changed for clarity in how they work within the labeller argument.