Which parameter decides the line type & plot symbol respectively?
Answers
Answer:
The R programming language is very useful for creating plots. This is because it has many built-in plotting functions. The R users have higher control to bring about their desired graphic.
The “plot()” command is the most important and most generic command used for drawing plots.
This command takes in many arguments out of which what we are concerned is the argument used for line type and plot symbol. The plot if defined as line, we need to add the argument “type” whose value will be “l”. If we choose this, the default line plot is solid lines. But if we want to define the type of line , then we need to use additional argument called “lty”.
For example
plot(x, y, type = l, lty = dashed)
This means the plot will be a dashed line plot.
Other values for lty are
• dotted
• dotdash
• longdash
• twodash
The pch argument is used to decide the plot symbol. We can provide give values to the argument like pch=21 which is for a circle, pch=22 is for a square. You can specify your own symbols.
For drawing a scatter plot of filled circles, the command would be
plot(x, y, type = p, pch = 19)