Due to a journal's requirements, I need to format p values as capital, italic P and the values themselves without leading zero, for example, P = .01. I would like to include some p value labels in plots of mine.
My trouble is that I need to use plotmath
expressions in order to render an italic P (as far as I know) but plotmath
always renders the value with a leading zero even if I enter a string without it. As an example
ggplot2::ggplot(data.frame(x = 1, y = 1)) +
ggplot2::geom_text(x = 1, y = 1, label = "italic(P) == .01", parse = TRUE)
Created on 2021-05-03 by the reprex package (v1.0.0)
Does anyone know a solution to this problem? I guess either removing the leading zero with plotmath
or italicizing the P without plotmath
are possible options.
One way would be to use the number as string.