wilkelab / ggtext

Improved text rendering support for ggplot2
https://wilkelab.org/ggtext/
GNU General Public License v2.0
650 stars 37 forks source link

How to add a horizontal bar #91

Open kongdd opened 1 year ago

kongdd commented 1 year ago

Dear @clauswilke

Could you give some guidance how to add a horizontal bar in a variable, just like \bar(x) in latex? Thanks very much!

Dongdong

clauswilke commented 1 year ago

I don't think that possible currently, unfortunately.

teunbrand commented 1 year ago

You can add the unicode overline \u0305 after the character that needs it.

library(ggplot2)
library(ggtext)

ggplot() +
  annotate(
    "richtext",
    x = 1, y = 1, label = "Fooba\u0305r",
    size = 10
  )

Created on 2023-04-21 with reprex v2.0.2