Beginner's guide to R: Painless data visualization




plot(mtcars$disp, mtcars$mpg)

Default scatterplot in R.

You really can't get much easier than that.






Adding a main headline
Adding a main headline and axes labels to an R plot.

What's las and why is it 1? las refers to label style, and it's got four options. 0 is the default, with text always parallel to its axis. 1 is always horizontal, 2 is always perpendicular to the axis and 3 is always vertical. For much more on plot parameters, run the help command on par like so:



Why use an add-on package if you don't need something discipline-specific? If you're doing more complex dataviz, or want to pretty up your graphics for presentations, some packages have more robust options. Another reason: The organization and syntax of an add-on package might appeal to you more than do the R defaults.

Using ggplot2

In particular, the ggplot2 package is quite popular and worth a look for robust visualizations. ggplot2 requires a bit of time to learn its "Grammar of Graphics" approach.

1 2 3 4 5 6 7 8 Page 1
Page 1 of 8
7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon