Sorry if its very simple, but I don't know how to write x with a tilde as y axis label in plot function not ggplot2? I tried some codes but did not work at all. Any help?
Asked
Active
Viewed 2,475 times
0
-
Show what you tried, maybe I can help if I see the code – sconfluentus Jan 17 '18 at 04:31
-
I used this [link](https://stackoverflow.com/questions/39671612/how-to-type-tilde-in-formulas-in-rmarkdown). – user3575805 Jan 17 '18 at 04:38
-
That is not for ggplot, that is for an rMarkdown PDF, they are talking about escaping a tilde. You seem to want to label a plot, but I need to see your code to help you. What I meant before was copy YOUR R CODE (even wrong code) and add it using `{ }` from the tool bar to enclose the code. – sconfluentus Jan 17 '18 at 04:42
-
{plot(A~B, data=Rain, xlab=expression('RF'[obs]),ylab ="RF" tilde(x) ,main = "Rainfall(mm)") – user3575805 Jan 17 '18 at 04:50
1 Answers
1
Wrap the unquoted ?plotmath
expression in expression
, whether in ggplot:
library(ggplot2)
ggplot(data.frame()) + ylab(expression(tilde(x)))
or base R:
plot(1, ylab = expression(tilde(x)))

alistaire
- 42,459
- 4
- 77
- 117