Getting Started with the ggplot2 Package
Learn what the ggplot2 package is and what makes it popular.
Overview of the base graphics
package in R
The base graphics
package is contained in the graphics package distributed in base R. These are often used for creating data graphics, and the system provides many global parameters that can be set and manipulated to create a data chart.
Let’s quickly understand how to create plots using the base graphics
package before introducing the ggplot2
package. The base graphics
package in
R offers several high-level functions, such as:
plot()
: This is a generic function that can plot a variety of plots.boxplot()
: This creates single and side-by-side boxplots.hist()
: This function creates histograms.qqplot()
,qqnorm()
, andqqline()
: These functions build quantile plots.dotchart()
andstripchart()
: These functions are for creating dot plots.image()
,contour()
, andpersp()
: These functions create 3D plots.pairs()
: This function plots scatter plot matrices.
Additionally, we can find simple functions like lines()
, plots()
, symbols()
, arrows()
, and many more in the base graphics
package for creating data visualizations.
Now, let’s try a few examples to understand how data visualizations can be created using the base graphics
package.
First, we’ll prepare a dataset with random numbers using the following code:
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy