Site icon R-bloggers

How to Use Italic Font in R

[This article was first published on Data Science Tutorials, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The post How to Use Italic Font in R appeared first on Data Science Tutorials

What do you have to lose?. Check out Data Science tutorials here Data Science Tutorials.

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

The code below demonstrates how to use the italic 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'))))

Check your inbox or spam folder to confirm your subscription.

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

The post How to Use Italic Font in R appeared first on Data Science Tutorials

Learn how to expert in the Data Science field with Data Science Tutorials.

To leave a comment for the author, please follow the link and comment on their blog: Data Science Tutorials.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.