From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Plotmath and expression

Plotmath and expression

- [Instructor] I was making a plot in R and ran into a problem. I wanted one of the labels to have a division sign instead of a slash. On screen right now you can see the code for a plot and the label blue slash green, but I didn't want that to be blue slash green. I want it to be really clear that it was blue divided by green, so I was looking for the division symbol. Well, how do you produce that? And to do that, you'll need plot math and a function called expression. So let's take a look at the expression function first. Here's how it works. Instead of a slash I want the division sign and so what I need to do is enclose that in an expression function, just like this. Of course, I need to close the parentheses. And then inside of expression, I'm going to change this just slightly. I'm going to add a quote sign and then percent slash percent followed by a space and another quote sign. Now, when I run the function…

Contents