**Question:** Can we draw graphics in R language?

**Answer:** Yes. R language produces high quality statistical graphs. There are many useful and sophisticated kinds of graphs available in R.

**Question:** Where graphics are displayed in R?

**Answer:** In R, all graphs are produced in a windows named Graphic Windows which can be resized.

**Question:** What is the use of plot function in R?

**Answer:** In R, plot() is a generic function that can be used to make a variety of point and line graphs. plot() function can also be used to define a coordinate space.

**Question:** What are the arguments of plot() function?

**Answer:** There are many arguments used in plot() function. Some of these arguments are x, y, type, xlab, ylab, etc. To see the full list of arguments of plot(), write the command in R console;

args(plot.default)

**Question:** Does all arguments are necessary to be used in R?

**Answer:** No. The first two arguments x and y provide the horizontal and vertical coordinates of points or lines to be plotted and also define a data-coordinate system for the graph. At least argument x is required.

**Question:** What is the use of the argument type in plot() function?

**Answer:** The argument type determines the type of the graph to be drawn. There are several types of graph that can be drawn. The default type of graph type=’p’, plots points at the coordinates specified by x and y argument. Specifying type=’l’ produces a line graph, and type=’n’ sets up the plotting region to accommodate the data set but plots nothing.

**Question:** Is there other types of graph are?

**Answer:** Yes. Setting type=’b’, draw graphs having both points and lines. Setting type=’h’ draws histogram like vertical lines and setting type=’s’ and type=’S’ draws stair-step-like lines starting horizontally and vertically respectively.

**Question:** What is the use of xlim and ylim in plot() function?

**Answer:** The argument xlim and ylim may be used to define the limits of the horizontal and vertical axes. Usually these arguments are unnecessary, because R langauge reasonably pick limits from x and y.

**Question:** What is the purpose of xlab and xlab argument in plot() function?

**Answer:** xlab and ylab argument tack character-string arguments to label the horizontal and vertical axes.

**Question:** Provide few examples of plot() function?

**Answer:** Suppose of have data set on variable x and y, such as

x <- rnorm(100, m=10, sd=10)

> y <- rnorm(100)

> plot(x, y)

> plot(x, y, xlab=’X (Mean=10, SD=10)’, ylab=’Y (Mean=1, SD=1)’ , type=’l’)

> plot(x, y, xlab=’X (Mean=10, SD=10)’, ylab=’Y (Mean=1, SD=1)’ , type=’o’)

> plot(x, y, xlab=’X (Mean=10, SD=10)’, ylab=’Y (Mean=1, SD=1)’ , pch=10)