Last week I spoke to an analyst, advised him on what skills to learn next, and helped him plan a career path. He's a smart guy with an analytical background and little programming experience, but he's new to R.

Towards the end of the conversation, I asked him, "What is your biggest challenge right now, Learning Analytics?"

Your answer? "The Code is intimidating."

I understand. Learning R can seem daunting.

Here is an example. Take the following line graph R.

This is a table of CO2 emissions data for China (fromThe World Bank) made with Rggplot2Package.

Here is the code that produced it:

# LOAD GGPLOT2 GRAPHICS PACKAGElibrary(ggplot2)# LEER EN DATOSaño <- c("1961","1962","1963","1964","1965","1966","1967","1968","1969 ","1970","1971","1972","1973","1974","1975","1976","1977","1978","1979","1980","1981", „1982“, „1983“, „1984“, „1985“, „1986“, „1987“, „1988“, „1989“, „1990“, „1991“, „1992“, „1993“, „199 ","1995","1996","1997","1998","1999","2000","2001","2002","2003","2004","2005","2006 ", "2007", "2008", "2009", "2010") CO2_EMISION_PER_CAP_QT <- AS.NUMERIC (C ("0,836046900792028", "0,66142816438381093", "0,661428164381093", 0,64000189360285, "," 655556560605399360285 "," 0.655556564605399360285 "," 0,6556560605399360285 "," 0,6556560605399360285 "," 0,6556564605399360285 "," 0,6556564605399360285 "," 0. " 0.574162146975018","0.60545199674633","0.725149509123457","0.942934534989582", "1.04223969658961","1.08067663654397","1.09819569131687","1.09736711056811","1.25012409495905","1.28528313553995","1.38884289658754","1.52920110964112","1.5426750986837" ,"1.49525074931 082","1.46043181655825","1.56673968353113","1.62905590778943","1.75044806018373","1.87105479144466","1.93943425697654","2.03841068876927","2.1509052249848", "2.15307791087471","2.16770307659104","2.24590127565651","2.31420729031649" ,"2.44280065934625","2.56599389177193","2.75575496636525","2.84430958153669","2.82056789057578","2.67674598026467","2.64864924664833","2.69686243322549","2.74212081298895 ","2.88522504139331","3.51224542766222","4.08013890554173"," 4.4411506949345","4.89272709798477","5.15356401658718","5.31115185538876","5.77814318390097","6.19485757472686"))# COMBINA DATOS EN DATAFRAMEdf.china_co2 <- data. frame(year,co2_emission_per_cap_qt)# PLOT CON GGPLOT2 PACKAGEggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="#aa0022", size=1.75) + geom_point( color="#aa0022", tamaño=3.5) + escala_x_discreta(cortes=c("1961","1965","1970","1975","1980","1985","1990","1995", "2000", "2005", "2010")) + ggtitle ("China CO2-Emissionen, jährlich") + labs(x="", y="CO2-Emissionen\n(metrische Tonnen pro Kopf)") + Thema(axis.title.y = element_text(size=14, family="Trebuchet MS", color="#666666")) + theme(axis.text = element_text(size=16, family="Trebuchet MS") ) + tema(trama.título = elemento_texto(tamaño=26, familia="Trebuchet MS", cara="negrita", hjust=0, color="#666666" ))

If you are new to analytics and just getting started, this may seem intimidating. Is closed. There's a lot going on here.

But don't be intimidated. I will not say that this is the case.*simply*, but it is very systematic and straightforward once you learn how to do it.

Also, it's important to realize here that I didn't sit down to fully develop this code. No code, no visualization appears fully formed.

It's very important.

Understand: Visualization is iterative.

## The iterative process of data visualization

The complete code above is the result of a*Minutes*, an iterative process that builds the visualization piece by piece, line by line of code.

I'll walk you through this process step by step, using the tutorial to illustrate an important point about learning and performing data analysis.

### Step 1: Simple R Line Chart

Let's start with two lines of code (note that I won't explain how to create the data frame in this tutorial).

ggplot(data=df.china_co2, aes(x=año, y=co2_emission_per_cap_qt,group=1)) + geom_line()

OK. This is fleeting.

The X axis labels are "tight". There are too many grid lines. There is no title. The axis titles are read as variable names, not as in English. That means,*this is not really functional.*But overall, this is very close to the final product.*With just two lines of code*, we plot our data on a simple line graph. We just need to clean it up a bit.

Before we do that, let's check*how this sample code works*. (Note: most of the following is based on thebasic line charttutorial. It may be instructive to check.)

I want you to understand that there is a deep structure behind the line chart. There is a deep structure behind*all data visualizations*.

#### Specify the data to graph

In the first line we call the ggplot() function. And inside the ggplot() function, the first thing we see is the data= parameter. This parameter allows us to specify the data that we are going to graph. Our data is in the data frame df.china_co2, so we indicate this with: data=df.china_co2.

#### Create a relationship between variables and visual elements

Next, you will see a call to the aes() function. This is a really important feature in ggplot2 as it allows us to build relationships between the variables in our data set and the aesthetic properties of the geometric objects we draw on the plot. Conceptually (according tographic grammar) a data visualization can be divided as follows: systematic drawing of geometric objects on a plot surface so that the data is directly related to the aesthetic properties (x-position, y-position, color and size) of these geometric objects.

#### drawing things

Now that we specify our dataset with data= and specify how the variables in our dataset relate to the aesthetics of the plot with aes(), we need code to do the actual work.*drawing*.

This is what geom_line() does. It tells the ggplot() function that we want to draw lines. This is important because the ggplot2 package is configured to allow us to plot a variety of geometries: lines, points, bars, boxes (and more complicated shapes). More on this in a second.

Go back to geom_line(). More specifically, we draw line segments connecting data points. To be clear, but geom_line() only draws the*lines*, not the points themselves.

I want to see the points Add a line of code.

### Step 2 - Add Points (New Layer)

Here we add points on top of the already drawn line segments.

This clarifies the concept of*layers*This is part of what makes the ggplot2 package so powerful. We can create layered charts and plot multiple data items on a single chart. Here we are layering in a simple way (points on line segments), but layers can be quite complex and lead to some very fancy graphics (more on that another time).

Also note that regarding*Minutes*, let's build this data visualization in layers.

# add points ggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line() + geom_point()

Remember that adding points here with geom_point() is essentially the same as drawing points for ascatter plot.

### Step 3: Add Color

Next, we'll make some minor changes to our geometric objects, our points and lines. We will do it:

1. Increase the size

2. Add color

To do this, we set two parameters to both geom_line() and geom_point().

# Add color, change size/color of geometric objects ggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="#aa0022", size=1.75) + geom_point (color="#aa0022", size=3.5)

We change the color of our geoms with the color= parameter and the size with the size= parameter. Note that in this code we set them for each geom individually. For now, let's set the color of our linear geoms and our point geoms to the same color.color hexadecimal, #aa0022. If we wanted, we could set them to different colors.

### Step 4: Edit grid lines

Color and size make our line look bolder and more aesthetically pleasing, but overall, the story is still messy. To fix this, we are going to specify the exact "breaks" for our gridlines usingfunction c().

(Note: I won't fully explain the c() function here. I'll do a tutorial on it at some point. But in short, it's a function that allows you to combine a set of values into a collection.)

# Genaue X-Achsen-Markierungen definierenggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="#aa0022", size=1.75) + geom_point(color=" # aa0022", tamaño=3.5) + escala_x_discreta(cortes=c("1961","1965","1970","1975","1980","1985","1990","1995","2000" , "2005", "2010"))

scale_x_discrete() allows us to specify discrete breaks for our x-axis. Inside this function, we use breaks=c("1961", "1965" ...) to specify exactly where we want our grid lines to be.

We now have grid lines at 5 year intervals. This gives us a much cleaner and more readable plot.

(Aside, note that I also added a line in "1961". You could argue that you removed it, but the addition frames the plot a bit better. It also shows that ggplot2 has a lot of flexibility, for example you can add a grid line in any place.)

### Step 5 - Add Title, Edit Axis Labels

Next, we'll add chart titles and edit the axis titles. We do this with two lines of code:

ggtitle("China CO2 Emissions, Annual") + labs(x="", y="CO2 Emissions\n(metric tons per capita)")

ggtitle() does exactly what you think it does. Add a title.

We can use the labs() function to set the titles (labels) for our x and y axes. Here we remove the x-axis label by setting it to "" (I removed it because it's clear from the title and the dates themselves that these are years on the x-axis). We will also add an English title for the Y axis.

This gives us the following frame code:

# ADD TITLE AND X,Y LABELS #aa0022", size=3.5) + scale_x_discrete(breaks=c("1961","1965","1970","1975","1980","1985","1990" ,"1995","2000" ,"2005","2010")) + ggtitle("China CO2 Emissions, Annual") + labs(x="", y="CO2 Emissions\n(metric tons per capita)")

And the resulting plot:

That looks much better. We almost arrive.

### Step 6: Format titles and axes

As a final step, let's refine the chart a bit by formatting the chart title, y-axis title, and axis grid line labels. To do this, we add three new lines of code, giving us the following complete frame code:

# TITEL UND ACHSEN FORMATIERENggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="#aa0022", size=1.75) + geom_point(color="#aa0022" , size=3.5) + scale_x_discrete(cuts=c("1961","1965","1970","1975","1980","1985","1990","1995","2000","2005 ","2010")) + ggtitle("China CO2-Emissionen, jährlich") + labs(x="", y="CO2-Emissionen\n(metrische Tonnen pro Kopf)") + theme(axis.title. y = text_element(size=14, family="Trebuchet MS", color="#666666")) + theme(plot.title = element_text(size=26, family="Trebuchet MS", face="bold", hjust =0, color="#666666")) + theme(text.axis = text_item(size=16, family="Trebuchet MS"))

Which produces the final r line graph:

The ggplot2 theme system is itself a separate set of tutorials, but essentially we set the color, font family, and size of the text elements (titles and labels).

## The importance of the process.

In the previous tutorial, we divided building a data visualization into a process.

The thing to keep in mind is that most of the time this is exactly how I write code and create new visualizations. iterative. Learn to create this way.

Also note that this extends to analytics and data science more broadly. Whether your output is a diagram, presentation, or model, you need to start thinking about iterative processes that gradually build to the end result.

This emphasis on process (and ultimately workflow) is really what separates the people who swim from the people who get stuck in the data.

### Appendix: full "iterative" code, R line graph

Jahr <- c("1961","1962","1963","1964","1965","1966","1967","1968","1969","1970","1971"," 1972","1973","1974","1975","1976","1977","1978","1979","1980","1981","1982","1983","1984" ,"1985","1986","1987","1988","1989","1990","1991","1992","1993","1994","1995","1996"," 1997","1998","1999","2000","2001","2002","2003","2004","2005","2006","2007","2008","2009" ,"2010")co2_emission_per_cap_qt <- as.numeric(c("0.836046900792028","0.661428164381093","0.640001899360285","0.625646053941047","0.665524211218076","0.710891381561055","0.574162146975018","0.60545199674633","0.725149509123457", "0.942934534989582","1.04223969658961","1.08067663654397","1.09819569131687","1.09736711056811","1.25012409495905","1.28528313553995","1.38884289658754","1.52920110964112","1.5426750986837","1.49525074931082","1.46043181655825","1.56673968353113 ","1.62905590778943","1.75044806018373","1.87105479144466","1.93943425697654","2.03841068876927","2.1509052249848","2.15307791087471","2.16770307659104","2.24590127565651 ","2.3 1420729031649","2.44280065934625","2.56599389177193","2.75575496636525","2.84430958153669","2.82056789057578","2.67674598026467","2.64864924664833","2.69686243322549","2.74212081298895","2.88522504139331","3.51224542766222" ,"4.08013890554173" ,"4.4411506949345","4.89272709798477","5.15356401658718","5.31115185538876","5.77814318390097","6.19485757472686"))df.china_co2 <- data.frame(year,co2_emission_per_cap_qt)# Plot Lineggplot(data=df .china_co2, aes (x=año, y=co2_emission_per_cap_qt,group=1)) + geom_line()# Add Pointsggplot(data=df.china_co2, aes(x=año, y=co2_emission_per_cap_qt,group=1)) + geom_line( ) + geom_point( )# Farbe hinzufügen, Größe/Farbe von geometrischen Objekten ändernggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="#aa0022", size= 1.75) + geom_point (color="#aa0022", size=3.5) # Genaue X-Achsen-Markierungen definierenggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color ="#aa0022" , tamaño=1.75) + geom_point(color="#aa0022", tamaño=3.5) + scale_x_discrete(breaks=c("1961","1965","1970","1975","1980","1985"," 1990","1995","2000","2005" ,"2010"))# TITEL HINZUFÜGEN UND X, Y Labelsggplot(data=df.china_co2, aes(x=year, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="#aa0022", size=1.75) + geom_point(color="#aa0022", size=3.5) + scale_x_discrete(breaks=c("1961","1965","1970","1975" ,"1980","1985","1990","1995","2000","2005","2010")) + ggtitle("China CO2-Emissionen, jährlich") + labs(x="", y="Emisiones de CO2\n(metrische Tonnen pro Kopf)") # TITEL UND ACHSEN FORMATIERENggplot(data=df.china_co2, aes(x=año, y=co2_emission_per_cap_qt,group=1)) + geom_line(color="# aa0022", tamaño=1.75) + geom_point(color="#aa0022" , tamaño=3.5) + scale_x_discrete(breaks=c("1961","1965","1970","1975","1980","1985 ","1990","1995","2000","2005 ","2010")) + ggtitle("China CO2-Emissionen, jährlich") + labs(x="", y="CO2-Emissionen\ n(metrische Tonnen pro Kopf)") + tema(eje.título.y = elemento_texto(tamaño= 14, familia="Trebuchet MS", color="#666666")) + tema(eje.texto = elemento_texto(tamaño=16, familia="Trebuchet MS")) + tema(parcela.título = elemento_texto(tamaño= 26, family="Trebuchet MS", face="negrita", hjust=0, color="#666666" ))

## FAQs

### How do you complete a line graph? ›

- Step 1: Identify the variables. ...
- Step 2: Determine the variable range. ...
- Step 3: Determine the scale of the graph. ...
- Step 4: Number and label each axis and title the graph.
- Step 5: Determine the data points and plot on the graph. ...
- Step 6: Draw the graph.

**What function creates a line chart in R? ›**

The **plot()** function in R is used to create the line graph.

**What does line () do in R? ›**

The line is plotted by connecting the points by joining the line segments between them. Lines () function is used for **plotting more than one line on a line chart**. Once the first line is plotted, we can use the lines () function to add another input vector to draw the second line in the line chart.

**What makes a graph complete? ›**

Definition: A complete graph is **a graph with N vertices and an edge between every two vertices**. ▶ There are no loops. ▶ Every two vertices share exactly one edge. We use the symbol KN for a complete graph with N vertices.

**How do I write a graph? ›**

**Writing about Graphs: Overview**

- Underline key words. Write related words – turn nouns into verbs, verbs into nouns, adjectives into adverbs, etc. ...
- Circle and highlight the graph. Use arrows. ...
- Identify trends. A trend is the overall idea of the graph.
- While You Write: Some Don'ts.

**What is a simple line graph? ›**

A simple line graph is **the most basic type of line graph**. In this graph, only one dependent variable is tracked, so there is only a single line connecting all data points on the graph. All points on the graph relate to the same item, and the only purpose of the graph is to track the changes of that variable over time.

**What are three ways to graph a line? ›**

There are three basic methods of graphing linear functions. The first is by **plotting points and then drawing a line through the points**. The second is by using the y-intercept and slope. The third is applying transformations to the identity function f(x)=x f ( x ) = x .

**How do you plot different graphs in R? ›**

We can put multiple graphs in a single plot by **setting some graphical parameters with the help of par() function**. R programming has a lot of graphical parameters which control the way our graphs are displayed. The par() function helps us in setting or inquiring about these parameters.

**How do you add data to a graph in R? ›**

Adding text to a graph: **the “text()” function**

R got what you want! You just need to bring 2 information with you: the text you want to add, and where you want to add it! Easy, right? Once that gathered, the “text()” function will do the rest of the work for you.

**How do I show a line in R? ›**

R – Line Plot

To draw a line plot in R, **call plot() function and along with the data to plot, pass the value “l” for “type” parameter**. In this tutorial, we will learn how to use plot() function to draw line plot, with example programs.

### How do I run a line by line in R? ›

On your keyboard: **press CTRL+ENTER** . The line will be executed, the cursor jumps into the next line. Again, press CTRL+ENTER to execute the next line … and so far, and so on.

**What are the types of the line chart in R? ›**

The different line types

line type (lty) can be specified using either **text (“blank”, “solid”, “dashed”, “dotted”, “dotdash”, “longdash”, “twodash”) or number (0, 1, 2, 3, 4, 5, 6)**.

**What is the line type in R basic plot? ›**

In R base plot functions, two options are available **lty and lwd**, lty stands for line types, and lwd for line width. The type of line you can be specified based on a number or a string. In R the default line type is “solid”.

**How do you find the slope and y intercept in R? ›**

Another way of calculating the intercept and slope is **through the R function lm()** . When you tell lm() your regression model, it produces your intercept and slope coefficients. You give lm() your model by first specifying the y (or response) variable, followed by a ~ symbol, then your x (or predictor variable).

**How do I hash out a line in R? ›**

If you use RStudio, you can use the keyboard shortcut **Ctrl + Shift + C** ( Command + Shift + C on macOS) to comment out a line of text.

**What are the 3 things a graph must have? ›**

The essential graph elements that should be included in almost every graph are… **Clearly visible data points.** **Appropriate labels on each axis that include units.** **A trend line showing the mathematical model of the fit of your data, when appropriate**.

**How is line graph made? ›**

In line graphs, the line is created by **connecting each individual data point to show local changes**, in this way, the local change from point to point can be seen. This is done when it is important to be able to see the local change between pair of points.

**What makes a good line graph? ›**

Line graphs are used to track changes over short and long periods of time. When smaller changes exist, line graphs are better to use than bar graphs. Line graphs can also be used to compare changes over the same period of time for more than one group.

**How do you check if a graph is complete or not? ›**

In the graph, **a vertex should have edges with all other vertices, then it called a complete graph**. In other words, if a vertex is connected to all other vertices in a graph, then it is called a complete graph.

**How many sides does a complete graph have? ›**

A complete graph has an edge between any two vertices. You can get an edge by picking any two vertices. So if there are n vertices, there are n choose 2 = (n2)=n(n−1)/2 edges.

### What are the five main features of a line graph? ›

Features of a Line Graph

These 5 main features are the **title, scale, points, labels, and line**.

**What is the formula for a graph? ›**

To graph the equation using the slope and y-intercept, write the equation in the form **y = mx + b** to find the slope m and the y-intercept (0, b).

**How do you summarize a line graph? ›**

**An overview should be one paragraph that summarises the key trends shown in the line graph(s)**. The key trends are the main increase and decreases in the graph, in other words, the most noticeable features. Do not go into too much detail by referring to specific figures, save the detail for your main body paragraphs.

**What is the line graph answer? ›**

Solution: A line graph is **a type of graph that shows the relationship between two numbers**. One number is plotted on the x-axis, and the other is plotted on the y-axis. The x-axis represents time, while the y-axis represents a value.

**Why is line graph easy? ›**

It is beneficial for showing changes and trends over different time periods. It is also helpful to show small changes that are difficult to measure in other graphs. Line graph is common and effective charts because **they are simple, easy to understand, and efficient**.

**What is an example of a line graph? ›**

A line graph, also known as a line chart, is a type of chart used to visualize the value of something over time. For example, **a finance department may plot the change in the amount of cash the company has on hand over time**. The line graph consists of a horizontal x-axis and a vertical y-axis.

**What is the formula for line? ›**

The equation of a straight line is **y=mx+c** y = m x + c m is the gradient and c is the height at which the line crosses the y -axis, also known as the y -intercept.

**How do you graph a line with two points? ›**

**Steps to find the equation of a line from two points:**

- Find the slope using the slope formula. ...
- Use the slope and one of the points to solve for the y-intercept (b). ...
- Once you know the value for m and the value for b, you can plug these into the slope-intercept form of a line (y = mx + b) to get the equation for the line.

**How do you make a line graph look better? ›**

**7 steps to make a professional looking line graph in Excel or...**

- Replace the legend with direct labels.
- Remove gridlines or make them lighter.
- Clean up the axes.
- Consider selective data labels.
- Add text that explains the message.
- Increase font sizes so they are easy to read.
- Use color to focus attention.

**How do I make R more readable? ›**

One of the best things you can do to make R code readable and understandable is **write comments** - R ignores lines that start with # so you can write whatever you want and it won't affect the way your code runs.

### What is a good size for a graph? ›

For PDF graphs this is easiest to deal with, where you specify width and height in inches anyway. Even if you plan to display your graph on a huge poster, it's best to stick with human-scale dimensions of **7-10 inches per side**. This is a size that would fit comfortably when printed on Letter (US) or A4 (metric) paper.

**How do you make a line graph with two sets of data in R? ›**

To plot multiple datasets, we **first draw a graph with a single dataset using the plot() function.** **Then we add the second data set using the points() or lines() function**.

**How do I plot multiple graphs side by side in R? ›**

With this method, you first need to specify the number of rows and columns of plots you would like and then run the code for each plot. For example, to plot two graphs side by side we would use **par(mfrow = c(1, 2)) to split the device into 1 row and two columns**.

**How do you add data to a line graph sheet? ›**

**In order to create a Line Graph in Google Sheets, you need to follow the basic steps which are:**

- Enter your data,
- Highlight the data you want to be in the graph,
- Click on “Insert Graph” from the top toolbar,
- Choose your desired chart,
- Customize and place your chart.

**How to make a line graph in R using ggplot2? ›**

**Creating a simple line graph**

- Specify the dataset within. ggplot() ggplot()
- Define the. geom_line() plot layer.
- Map the. year. to the x-axis and the life expectancy. lifeExp. to the y-axis with the. aes() function.

**How do I plot a line in a scatter plot in R? ›**

A scatter plot can be created using the function plot(x, y). The function lm() will be used to fit linear models between y and x. **A regression line will be added on the plot using the function abline(), which takes the output of lm() as an argument**. You can also add a smoothing line using the function loess().

**How do you add grid lines in R? ›**

In R you can add gridlines **using the abline() command**.

**How do you plot a correlation line in R? ›**

In order to compute a correlation in R, we **use the cor() function**. The first argument x is the first of the two variables for which we would like to calculate a correlation. The second argument y is the second of the two variables.

**How do you plot a line graph in matrices in R? ›**

To plot matrix columns as lines in base R, we can **use matplot function but we need to read the matrix as a data frame using as.** **data.** **frame function and for creating lines the type argument will be used**.

**What does Geom_line do in R? ›**

geom_line() connects them in order of the variable on the x axis. geom_step() creates a stairstep plot, highlighting exactly when changes occur. The group aesthetic determines which cases are connected together.

### What is a scatter plot in R? ›

R Scatter Plot

A "scatter plot" is **a type of plot used to display the relationship between two numerical variables, and plots one dot for each observation**. It needs two vectors of same length, one for the x-axis (horizontal) and one for the y-axis (vertical):

**How do you plot two regression lines in the same plot in R? ›**

To create multiple regression lines in a single plot using ggplot2, we can **use geom_jitter function along with geom_smooth function**. The geom_smooth function will help us to different regression line with different colors and geom_jitter will differentiate the points.

**How do I set up gridlines? ›**

To show the gridlines, in Excel, PowerPoint, or Word, **click the View tab, and then check the Gridlines box**.

**How do you make a line grid? ›**

To draw this grid, put your ruler at the top of the paper, and make a small mark at every inch. Place the ruler at the bottom of the paper and do the same thing. Then use the ruler to make a straight line connecting each dot at the bottom with its partner at the top.

**How do you show correlation on a graph? ›**

**Scatter graphs and line graphs** are used to show the potential correlation between two different variables. Scatter graphs can be used when the data from both variables under investigation is continuous.

**How to visualize the relationship between two variables in R? ›**

**Scatter plot** is one the best plots to examine the relationship between two variables. Lets draw a scatter plot between age and friend count of all the users. scatter plot is the default plot when we use geom_point().