Which of the following global options are available for figures in knitr?

fig.height
fig.size
fig.breadth
all of the mentioned

The correct answer is D. all of the mentioned.

The global options for figures in knitr are:

  • fig.height: The height of the figure in inches.
  • fig.size: The size of the figure in inches.
  • fig.breadth: The width of the figure in inches.

These options can be used to control the size and position of figures in a knitr document.

For example, to set the height of a figure to 2 inches, you would use the following code:

knitr::opts_chunk$set(fig.height = 2)

To set the size of a figure to 2 inches by 3 inches, you would use the following code:

knitr::opts_chunk$set(fig.size = c(2, 3))

To set the width of a figure to 3 inches, you would use the following code:

knitr::opts_chunk$set(fig.breadth = 3)

These options can also be used to control the placement of figures in a knitr document. For example, to place a figure at the top of the page, you would use the following code:

knitr::opts_chunk$set(fig.position = "top")

To place a figure at the bottom of the page, you would use the following code:

knitr::opts_chunk$set(fig.position = "bottom")

To place a figure in the middle of the page, you would use the following code:

knitr::opts_chunk$set(fig.position = "center")

These options can be used to customize the appearance of figures in a knitr document.

Exit mobile version