I want to plot data using ggplot(), that is split into multiple plots by using facet_wrap() on three different columns of the data. So let's say p is my plot created by ggplot2
, then I have
p +
facet_wrap(~ column1 + column2 + column3)
Each column is a factor variable with 2 - 3 levels. Per default, the labels of the individual plots only show the value of the corresponding level, but I also want to show which column the value is coming from. So if column1 represents beta_2, instead of a label just showing "150", I want it to show "beta_2 = 150", and I want "beta_2" to be displayed as a Greek letter subsetted by 2. The other columns have different names, but they all involve Greek letters and subsetting.
I tried multiple approaches involving renaming the levels with the TeX() function with the latex2exp package, or different labeller functions that switch the level value to an expression involving the column name as a Greek letter (tried to produce that with both expression()
as well as bquote()
), but nothing worked so far.
I would be very thankful for your help.