In this tutorial, the instructor demonstrates how to enhance basic R scatter/line plots using the Mercury data set (temperature vs. pressure). He walks through adding titles and axis labels (main, xlab, ylab), changing plot types (type='o' for points+lines, type='l' for lines only), and setting colors with the col argument. The video explains the distinction between per‑plot graphical parameters (specified directly in plot()) and session‑wide parameters set via par(), showing how par(col='blue') persists across subsequent plots. The instructor then focuses on key graphical parameters that can be passed to plot(): col for element colors, cex (cex.axis, cex.lab, cex.main) for scaling text, lty for line types, and pch for point symbols (over 35 options). Throughout, he emphasizes that while R offers extensive visual customization, the primary goal should remain interpretability and avoiding over‑decoration.
Chapters
The plots that I have shown you in the previous video and the ones you've created yourself in the interactive exercises look quite nice. But there are certainly more things we can do to make the plots fancier and more informative. What about setting a title or specifying the labels of the axes? All of this is possible from inside R. Throughout our experiments, we will be using the Mercury dataframe that lists pressure versus temperature measurements of Mercury. It contains two temperature and pressure. Let's start with a simple plot. We can clearly see that the pressure rises dramatically once the temperature exceeds 200 degrees Celsius. But this plot is still kind of dull, isn't it? Have a look at this code that specifies a bunch of arguments inside the plot function. The result looks like this. Can you tell which arguments led to which changes in the plot? XLAB and YLAB changed the horizontal and vertical axis labels respectively, while Main specified the plot title. If you set the type argument to O, you'll have both points and a line through this point on your plot. If you only want a line, you can use type isl, which looks like this. Finally, the col argument specifies the plot color. Most of the arguments that are used here, such as xlab, ylab, main, and type are specified in the documentation of the plot function. However, the plot function also allows you to set a bunch of other graphical parameters. An example of such a graphical parameter is col, which specifies the color, but there are also many others. You can specify these graphical parameters straight inside the plot function as you did with COL in this case. Here the graphical parameter only has an effect on this specific graph. If you now plot the same graph without the col argument, the green color is not there anymore. You can also inspect and control these same graphical parameters with the PAR function. Typing question mark PAR opens up its documentation with information on all the parameters that you can specify. Simply calling par gives you the actual values of these parameters. You can also use par with arguments to specify session wide graphical parameters. Suppose you set the color to blue using the par function and now create a plot. Of course it's blue. If you next create another plot, the plot is still blue. That's because parameters specified with parameter are maintained for different plotting operations. If you list all graphical parameters again and select the col element, you'll see that indeed it's still set to blue. For the rest of this video, let me focus on some of the most important graphical parameters. I'll do this by adding arguments to the plot function instead of using the par function. For this, you already know the first five graphical parameters similar to the col argument. The col main argument specifies the color of the main title. There are also other COL arguments to set the color of other elements in your plot. Next, the CEX axis argument specifies with which ratio the original font size of the axis tick mark should be multiplied. With CEX axis equal to 0.6, we have small labels. With CEX x is equal to 1.5, the labels become huge. Just as the call parameter has col for other elements in the plot, the CEX parameters also has its CEX variance. The LTY argument specifies the linetype, a linetype of 1 is a full line, and the types 2 to 6 are all different types of lines, like you can see here. Last but not least, we have the PCH argument which specifies a plot symbol for the points you are plotting. There are more than 35 different symbols for plotting, going from pluses and small octagonals to stars and hashtags. Like I said, all of these arguments are just the tip of the iceberg. One of R's main powers is visualization, and this is clear from the numerous ways in which you can make your plots ready for a report. Just make sure you don't overdo things. Interpretability should be the main goal at all times.