20,000+ Professional Language Experts Ready to Help. Expertise in a variety of Niches.
Unmatched expertise at affordable rates tailored for your needs. Our services empower you to boost your productivity.
GoTranscript is the chosen service for top media organizations, universities, and Fortune 50 companies.
Speed Up Research, 10% Discount
Ensure Compliance, Secure Confidentiality
Court-Ready Transcriptions
HIPAA-Compliant Accuracy
Boost your revenue
Streamline Your Team’s Communication
We're with you from start to finish, whether you're a first-time user or a long-time client.
Give Support a Call
+1 (831) 222-8398
Get a reply & call within 24 hours
Let's chat about how to work together
Direct line to our Head of Sales for bulk/API inquiries
Question about your orders with GoTranscript?
Ask any general questions about GoTranscript
Interested in working at GoTranscript?
Speaker 1: Hey everyone, I'm really excited to be launching a new course, a short course on an intro to data visualization with R and RStudio. So here is a short lesson from that course. Let me know what you think in the comments down below, subscribe to see more videos that are coming up, more lessons from this course that's about to launch, and be sure to pre-register for this course at the link below. All right, well, thank you so much, and with that, here is a lesson on ggplot2. Hi everyone, and welcome to lesson 6 in module 4 of this short course on data visualization. Now we're going to be shifting gears a bit and begin working on a more advanced system for data visualization that we'll be using for the rest of this course. So in this lesson, I'm just going to go over the basics about how ggplot2 works on a conceptual level. We're not going to do any coding yet, though I will show you the anatomy of how the code structure and syntax works for ggplot2. All right, so let's get into it. So the gg in ggplot stands for the grammar of graphics. The grammar of graphics provides a more intuitive way to create and customize figures. Just like a sentence is based around the combination of nouns, verbs, and adjectives, and other elements that work together to contribute different facets to the meaning of a sentence, data visualizations are made of several key elements that work together. So the most basic structure of a data visualization begins with the data themselves. Then various columns or variables of that data set are mapped onto different aesthetic properties of the figure. So for example, certain variables are mapped to the x and the y axis, and then you have other variables, in this case variable three, which is mapped to identify the point color in the figure. Anytime a variable is used to describe an aesthetic or visual component of the figure in this way, that is called mapping a variable to the aesthetic properties of the plot. And finally, those aesthetic mappings need to be presented using a geometric object. So this is what determines whether a figure will be a scatterplot, a boxplot, lineplot, or whatever other type of plot you want to create. So far the three elements we've gone over include the data, the aesthetic mapping, and then the geometry of the plot, but you have many other elements that might be the coordinates of a plot, or what part of the data you're going to be showing, as well as other visual properties of the figure that don't particularly have to do with the data, which in this case is called the theme, which might affect the font size, the font color, etc. of the plot. So now let's just do a quick overview of the anatomy of using ggplot, or the syntax of how ggplot functions come together. So first you begin with the ggplot function. Now note that the package is called ggplot2, but the basic function you begin with is just ggplot, without the two. Then the first argument to the ggplot function are the data that you're going to be using, and note that I'm trying to maintain the same color scheme here between these different elements and the actual code and syntax here that I'm showing. The next element of the ggplot function is the aesthetics, and these are the general aesthetics that apply to the whole plot. So for example, the most common aesthetics you're going to be adding in using the aes function are the x and the y values. So what aspects of the data map to the x and to the y coordinates of this plot. Then this is a little different than anything that you've been doing so far if you're familiar with the basics of R, but then to add functions to this, to add elements to this, we're going to just use this plus sign here. Add a new row, and now we're going to add the geometry to the plot. And this is where you can create a plot that's just a scatterplot, a boxplot, or whatever other type of plot you're creating. But for the sake of this example, we're just going to use create a scatterplot, and that is done by using the geom point, geom underscore point function. And within that geometry, we can add another aesthetic element. So again, using the aes function, and now we can map out different values from the data to things like the color of the points, or the fill of the points, or any other aesthetic property that might be connected to the data. And remember that because these points, these different elements are connected to different aspects of the data, we literally, we make that connection, we make that mapping by just saying equals, and then whatever the name of the variable or the column in that data that you want to refer to. So in the original example, we had variable one goes to the x axis, variable two goes to the y axis. And then within geom point, variable three goes to the color of the points. And finally, we can add another plus, and add whatever other element we would like to add. And there's many, many different elements to look at. Don't worry if this is a bit confusing, or if this seems like a lot to remember, there's actually a really good cheat sheet that ggplot developed. There's a link that I put down below to access this cheat sheet, I actually refer to it all the time. Here's my version. It's kind of old, but there might be an updated version. So that is basically the anatomy of how a ggplot function works. All right. Well, thank you so much for watching. I hope you enjoyed and I look forward to seeing you in the next lesson.
Generate a brief summary highlighting the main points of the transcript.
GenerateGenerate a concise and relevant title for the transcript based on the main themes and content discussed.
GenerateIdentify and highlight the key words or phrases most relevant to the content of the transcript.
GenerateAnalyze the emotional tone of the transcript to determine whether the sentiment is positive, negative, or neutral.
GenerateCreate interactive quizzes based on the content of the transcript to test comprehension or engage users.
GenerateWe’re Ready to Help
Call or Book a Meeting Now