'Including an intersect ($\bigcap$) symbol in a facet.grid label using ggplot

I wanted to ask for help on incorporating the $\bigcap$ notation into a facet.grid label using ggplot. Does anyone know how to do this?

I tried using label_parsed as below:

#Facet_grid with label_parsed 
data(iris)
iris$Species = as.character(iris$Species)
iris$Species[iris$Species == "virginica"] =  "NULL^14*C~Amino~Acids"
ggplot(iris, aes(Sepal.Width, Sepal.Length)) +geom_point() + facet_grid(~ Species, labeller=label_parsed)

#Facet_grid with label_parsed and intersect $\bigcap$ notation
data(iris)
iris$Species = as.character(iris$Species)
iris$Species[iris$Species == "virginica"] =  "E*$\bigcap$*O"
ggplot(iris, aes(Sepal.Width, Sepal.Length)) + geom_point() + facet_grid(~ Species, labeller=label_parsed)

Any help would be much appreciated!!



Solution 1:[1]

You could use intersect in plotmath notation, but this gives a normal sized cap. I think to achieve what you want, you may need to use Unicode and some inline size changes via ggtext

library(ggplot2)
library(ggtext)

data("iris")
iris$Species = as.character(iris$Species)
iris$Species[1:50] =  "O<span style='font-size:10mm'>\u2229</span>E"
ggplot(iris, aes(Sepal.Width, Sepal.Length)) +
  geom_point() + 
  facet_grid(~ Species) +
  theme(text = element_text(size = 16),
        strip.text = element_markdown())

Created on 2022-04-24 by the reprex package (v2.0.1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Allan Cameron