How to Use Italic Font in R

How to Use Italic Font in R, to create an italic typeface in R plots, use the basic syntax shown below.

How to Use Italic Font in R

These examples demonstrate how to apply this syntax in real-world situations.

Example 1: The plot’s title in italic font

The code below demonstrates how to use the italic font in the plot title in R:

Specify data

x <- c(1, 2, 3, 4, 4, 5, 6, 6, 7, 9)
y <- c(18, 12, 29, 10, 12, 13, 15, 12, 15, 25)

Make a scatterplot with an italicized title.

plot(x, y, main = substitute(paste(italic('Scatterplot of x vs. y'))))

Note that we can also choose to make only some of the title’s words italic:

make a scatterplot with only a portion of the title italicized.

plot(x, y, main = substitute(paste(italic('Scatterplot of'), ' x vs. y')))

Example 2: Italic Font on Axis Labels of Plot

create a scatterplot with axes labels in italics

plot(x, y, xlab = substitute(paste(italic('X Label'))),
           ylab = substitute(paste(italic('Y Label'))))

Example 3: Italic Font with Text in Plot

Now add italic text at location x=3, y=16

text(3, 16, substitute(paste(italic('datasciencetut.com'))))

Further Resources:-
The following tutorials provide guidance on using R.

One way ANOVA Example in R-Quick Guide – Data Science Tutorials

How to Replace String in Column using R – Data Science Tutorials

How to Calculate Lag by Group in R? – Data Science Tutorials

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

14 − nine =