ASCII ³ appears as 3 in ggplot2

I have a plot and I need to add mm³, but I can not use bquote because I need to wrap the text using

paste(strwrap(text, width), collapse="\n")

therefore, although I use the ASCII ³ bcause character that I need only one superscript value, but it displays as mm3 when rendering, is this a font problem? How to solve it? I need to run this on any platform, because other developers use Mac / Windows, I use windows and start a Linux server.

+4
source share
1 answer

Details on how to display math on graphs and other places in R are described in ?plotmath.

A simple example: building a city gas mill by engine size squared engine.

library(ggplot2)
ggplot(mpg) +
  aes(x = displ^2, y = cty) +
  geom_point() +
  xlab(expression(displ^2)) +
  ylab("City Miles Per Gallon")

enter image description here

0
source

Source: https://habr.com/ru/post/1687870/


All Articles