There are several kind of graphics available in R. E.g.
plot(); hist(); boxplot();The title of a plot is set with the additional argument
main = 'Main title'The axes names by the additional arguments:
xlab = 'x' for the x-axis; ylab = 'y' for the y-axis
Color can be set by argument col (e.g., col='red', col='grey', . . . )
Standard scatter or line plot
Needs the value for x-axis and the y-axis
different types can be chosen (via argument type):
‘p’ for points (default); ‘l’ for lines
A lot of styling options
See help for more details
A basic scatter plot is created with the basic plot function
Command hist()
Use the argument breaks=...> to have more or less bars;
Set option freq = TRUE for frequencies, freq = FALSE for densities (normalization of area to 1);
We use the built-in data set sleep.
Histogram using a single vector:
Command boxplot();
Easy to plot with different groups;
Parts of boxplot:
A boxplot with formula operator to make a boxplot for each group
This basically splits the vector into two vectors: one for each group.
Control flows and programming