Martin K
Martin K

Reputation: 15

How can I combine unicode to use it in ggplot2?

I need an L with a dot above (so basically U+1E36, but with the dot above the L) to include it in the title, e.g.

ggplot() + geom_line()  + labs(title = expression(paste("The title is ", frac(L with dot above,L))))

Unfortunately, I can`t find the Unicode for this, and I don't know how to combine Unicode, so it's working in ggplot. So, how can I do that? Thanks for any help!

Upvotes: 0

Views: 171

Answers (2)

Allan Cameron
Allan Cameron

Reputation: 173803

The Unicode for "dot above previous character" is U+0307, so you can do:

ggplot() + 
  geom_line() + 
  labs(title = "The title is L\u0307") + 
  theme(plot.title = element_text(size = 50))

Created on 2021-06-03 by the reprex package (v0.3.0)

Upvotes: 0

user2554330
user2554330

Reputation: 44867

You can use dot(L) in an expression to put a dot over it:

ggplot() + geom_line()  + labs(title = expression(paste("The title is ", frac(dot(L),L))))

See ?plotmath for the list of things that work in expressions in titles and labels.

Upvotes: 1

Related Questions