Using plotmath in ggplot2 with percent sign (%) Using plotmath in ggplot2 with percent sign (%) r r

Using plotmath in ggplot2 with percent sign (%)


Latin characters do not need any special treatment and you can see this in the first element of a. Try this:

a<-c("Delta~V","VarcoV","'%'*V","Delta~V","VarcoV","'%'*V")

The "%" sign is special so you need to quote it. You could have just done '%V' but I threw in the "*" (asterisk) to show how to separate plotmath tokens with no displayed space. (You already appear to know how to separate tokens with the spacing-separator, "~".)

The key lesson is to mix type of quotes. The first quote type will signal which type is used to terminate the character token/string. You can also use the escape character: "\". This also succeeds:

a<-c("Delta~V","VarcoV","\"%\"*V","Delta~V","VarcoV","\"%\"*V")