Text is defined as way to describe data related to graphical representation. They work as a labels to any pictorial or graphical representation. In this article we will learn to to add a text to a plot in R Language by using the
Syntax: text(x, y, labels)
x and y: numeric values specifying the coordinates of the text to plot
labels: the text to be written
Returns: Added text to plot
In above example, the text is added to plot of ‘mtcar’ dataset.
Example 2: Implementation of text() to add mathematical annotation to a plot
In above example the the
text() function is used to add mathematical annotation to a plot
Add text to the margins of the graph
mtext() function is used to add text to the margins of the plot.
Syntax: mtext(text, side)
text: text to be written
side: An integer specifying the side of the plot, such as: bottom, left, top, and right.
Returns: Added text in the margins of the graph
Here, in above example the side specifies the side of the plot such as bottom, left, top, right . And in the given the side=3 i.e the top part of the plot
- Creating 3D Plots in R Programming - persp() Function
- Plotting of Data using Generic plots in R Programming - plot() Function
- R - Stem and Leaf Plots
- Scatter plots in R Language
- Adding Noise to a Numeric Vector in R Programming - jitter() Function
- Adding axis to a Plot in R programming - axis () Function
- Adding Straight Lines to a Plot in R Programming - abline() Function
- Adding elements in a vector in R programming - append() method
- Adding Colors to Charts in R Programming
- Convert String to Double Quote Text in R Programming - dQuote() Function
- Convert String to Single Quote Text in R Programming - sQuote() Function
- Reading contents of a Text File in R Programming - read.table() Function
- Check if a Function is a Primitive Function in R Programming - is.primitive() Function
- Search the Interval for Minimum and Maximum of the Function in R Programming - optimize() Function
- Compute Variance and Standard Deviation of a value in R Programming - var() and sd() Function
- Calculate the Floor and Ceiling values in R Programming - floor() and ceiling() Function
- Naming Rows and Columns of a Matrix in R Programming - rownames() and colnames() Function
- Get Date and Time in different Formats in R Programming - date(), Sys.Date(), Sys.time() and Sys.timezone() Function
- Compute Density of the Distribution Function in R Programming - dunif() Function
- Apply a Function over a List of elements in R Programming - lapply() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.