Creating Graphs

Excel Visualizations

Basic charts can go a long way. Bar and pie charts, histograms, and scatter plots are very simple to make inside of Excel. First you will need to have the top row of each column be different variable names for your desired graph.
The first column will need to be strictly categorical. Examples of categorical data values are: months, years, sex, names, a word, brands, IDs, eras and more. There can be multiple categorical variables in your data set. Similarly, the other variables(columns) need to be strictly quantitative, or a numerical value. Make sure that the selected data has at least one categorical and one quantitative variable selected per chart.
Once the data has been collected, highlight the desired data and click on the insert tab.
Once the chart has been made,  right-click on the chart itself to format it. You can change the interval on the bottom axis, the color, data range, and position of the title and key.
The images below demonstrate some charts and their data. This logic can be applied to all of the other charts. If you have any other questions regarding Excel, Microsoft has a visual tutorial  explaining the chart features.
Above is a random data set pulled from RAWGraphs. The data is highlighted in different colors which indicate they are being used for different parts of the chart. The purple is the categorical data values whereas the blue are quantitative. The red highlighted cells correspond to the key on the charts displayed below.
Now that you know the necessary components, all you need to do is highlight the data and select the chart you would like to display your data with. To customize it, right click on the chart and click “Format Chart.”
Excel charts are not as customizable as other options discussed further on. A very useful aspect of excel charts though is how easy the charts are to export.
To export the chart as an image on a Mac, right-click on the chart and select “to make an image.”
On a PC, there are a few more steps. First, you will need to copy the chart, and then either paste it as a picture into Microsoft Word. You should then be able to save as a picture/png from there.
Both of these charts are using the same data and showing the same result; one just may be easier to read than the other.
If you are trying to paste data into a spreadsheet and it is not quite working, this button (under the data tab)could resolve the issue.

Web Resources for Making Graphs

ggplot2 Visualizations

A warning is needed before we go into details about RStudio and ggplot2.
This is a programming language!
And some basic knowledge about coding is needed to continue BUT… We have you covered. Joey Stanley has a great tutorial on
R and ggplot2. They are very thorough and discuss, with pictures, how to install, add the correct packages, and Joey assumes no prior knowledge. It is highly suggested if these types of visuals are wanted, that you take the time to read at least his tutorials. Here are more: ggplot2 tutorial and a ggplot2 cheat sheet.
The remainder of this section will assume a basic understanding of R and the ggplot2 package.
ggplot2 allows you to customize almost every aspect of the visualization by giving you the control to change more than just the color. You’ll be able to add layers of different types of charts, color code the data points to illustrate particular interactions, and also change the shape of the data points. Joey’s handout covers the different visualizations and how to do some specific changes to the chart, so to prevent redundancy, this tutorial will focus on the different, yet necessary,
components to create an elegant and illustrative visualization.
There are three different components to using ggplot2: Data (in red), Geom (in green), and Labels and Themes (in blue). The data component only calls for a few steps. Just save your data into a variable, let us call it “data,” which will be where our data set is stored. A line of code could look like: “data<- read.csv(file.choose())” and after then select your data file after running that line of code. The Geom is the most important attribute to the visualization. This function determines which type of visualization to plot. For this example, “geom_point()” creates the point plot. Change it to a boxplot, histogram, etc. The graph will change accordingly. It is also possible to add two geoms to the same plot. Just add it after the data component of the plot. Inside the geom function is where you clarify the two axis variables. Ideally you will want the categorical variable as your “x” variable and the quantitative variable as your “y”. If you decide to test two variables in your plot, you can color the points by a different variable. For this example, the “color=GENDER” is making the points in both columns different colors. Just change my variable, with the name of your own variable, and it will update accordingly. If you are only testing one variable, either leave the color attribute out of the code, or put in the name of the color. There are plenty of these examples in Joey’s tutorial, linked above. Lastly, the labels and theme. This component is self-explanatory. By default, ggplot2 names the axes by what the variable(column) name is. Being able to change the name helps readers understand this chart without any worries. If your data is in units, you should also include that in the axis label as well. The theme is just to take away some of the background noise. If you follow the cheat sheet, linked above, it is organized by these three components. It offers the different functions and a visual
to correspond. Last, but not least, it is very simple on how to export the graph. Inside RStudio, there is an export button above where the chart is displayed. Once its exported, it is your typical image file.
For this example, not having the colors separated, we could not tell a difference between the two columns. Do you notice anything different between the column with no children versus the one with child under 6? Thanks to the 2nd variable, we see a small shift in the women’s hours worked versus no shift in the men’s. Thus, we can conclude, when a married woman has no child under 6, she is more likely to work more hours per week however less likely to work as many hours with a child whom is under 6. While at the same time, there seems to be no correlation between hours work and a child under 6 for married men.
There are plenty of other resources for R and ggplot2 that can show you more than what is illustrated here. The first step is knowing which functions are doing what to the chart and what parameters are needed. I hope this portion of the tutorial was helpful, and good luck!