How to use bold font in R with examples. r-bloggers

- Advertisement -


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

- Advertisement -

How to use bold font in R with examples The post first appeared on Data Science Tutorials

- Advertisement -

What do you have to lose? Data Science Tutorials See Data Science Tutorials here.

How to Use Bold Fonts in R To create a bold typeface in R plots, use the basic syntax shown below:

- Advertisement -

substitute(paste(bold(‘datasciencetut.com’)))

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

Example 1: Plot’s axis labels in bold font

The code below demonstrates how to create a scatter plot in R with both axis labels in regular font:

How to use bold font in R, define data first

x <- c(1, 2, 3, 4, 4, 5, 6, 6, 7, 9) y <- c(38, 58, 55, 60, 65, 52, 40, 45, 34, 57)

To create a scatter plot with axis labels in regular font.

plot(x, y, xlab = ‘X label’, ylab = ‘Y label’)

Additionally, the code below demonstrates how to set a bold font for a plot’s x-axis and y-axis labels:

plot(x, y, xlab = substitute(paste(bold(‘X label’))), ylab = substitute(paste(bold(‘Y label’)))))

As you can see, the labels on both axes are now in bold.

Example 2: Bold font with text in the plot

Let x=3, y=54 . Add normal text in place

text(3, 54, ‘datasciencetut.com’)

Now we take the place x=6, y=64 . You can add bold text on

text(6, 64, substitute(paste(bold(‘datasciencetut.com’)))))

Note how the bold font differs from the regular type.

additional resources:-
The following tutorials provide guidance on using R to learn:

Change ggplot2 theme color in R-data science tutorial

Best GGPlot Themes You Should Know – Data Science Tutorials

How to Label Outliers in Boxplots in ggplot2? (datasciencetut.com)

How to use bold font in R with examples The post first appeared on Data Science Tutorials

Learn to become an expert in the data science field with Data Science Tutorials.

related



Source link

- Advertisement -

Recent Articles

Related Stories