How to highlight a value with underline in base R plot?

R ProgrammingServer Side ProgrammingProgramming

To highlight a value with underline in base R plot, we can use underline function within text function. The text function will be used to define the value that we need to underline in the plot and underline function will only underline that part.

Check out the below given example to understand how it works.

Example

To highlight a value with underline in base R plot, use the code given below −

plot(1:5)

Output

If you execute the above given code, it generates the following output −

To highlight a value with underline in base R plot, add the following code to the above code −

plot(1:5)
text(4,2,bquote("Point Chart of"~underline("1 to 5")))

Output

If you execute all the above given codes as a single program, it generates the following output −

raja
Published on 12-Nov-2021 08:24:01

Advertisements