Unique legends in facet_grid()

It's pretty hard to suggest a fix without a full reproducible example, called a reprex, which necessarily includes representative data. The data can either be an extract, a csv source posted as a gist on github or elsewhere. Ideally, there is a built-in dataset, such as the immortal mtcars that has a similar enough structure that you can just include the code to transform it to a functional equivalent.

Another alternative is a toy example to reduce your plots to the minimum necessary to illustrate the objective. Folk are more likely to work through such a problem than trying to follow all the detail here.