Latest / CyberSecurity Summary / Data Visualization: A Practical Introduction
Transcript
- 0:00Speaker 1: Okay, let's unpack this. You ever feel like you're just drowning.
- 0:03Speaker 2: In numbers, Definitely, spreadsheets everywhere, complex reports.
- 0:07Speaker 1: Exactly, grabs that maybe look cool but don't actually tell
- 0:10Speaker 1: you much. It's so easy to get lost in all
- 0:12Speaker 1: that data, right, But imagine if you could just see
- 0:15Speaker 1: through it all, if the numbers could instantly like paint
- 0:18Speaker 1: a clear picture.
- 0:19Speaker 2: That's the idea, isn't it. That's the real power of
- 0:22Speaker 2: data visualization, turning that overwhelming information into something you can grasp,
- 0:27Speaker 2: you know, quickly and really thoroughly.
- 0:29Speaker 1: Yeah, moving beyond just tables and stats exactly.
- 0:32Speaker 2: We're so used to looking at tables, maybe hearing about models,
- 0:35Speaker 2: and those have their place for sure, but a good
- 0:38Speaker 2: visualization it can give you that immediate kind of gut
- 0:42Speaker 2: level understanding, seeing the patterns, the relationships hiding in there.
- 0:45Speaker 1: It's like reading a recipe versus actually seeing the finished dish.
- 0:48Speaker 1: Like you said, yeah, precisely, And that brings us nicely
- 0:51Speaker 1: to our source for this deep dive. The book Data
- 0:55Speaker 1: Visualization A practical.
- 0:57Speaker 2: Introduction, Ah, yes, good one.
- 1:00Speaker 1: And this isn't just you know, a gallery of pretty charts.
- 1:02Speaker 1: It's a really practical, hands on guide mm hmm.
- 1:05Speaker 2: It walks you through using R the programming language and
- 1:10Speaker 2: this really flexible tool called gig plot two right.
- 1:14Speaker 1: And what I found really insightful is how it focuses
- 1:16Speaker 1: not just on the aesthetics like does it look.
- 1:18Speaker 2: Nice, although that matters.
- 1:20Speaker 1: True, but more on how our brains actually process visual
- 1:25Speaker 1: information and designing charts that work with that process.
- 1:29Speaker 2: That connection is key, isn't it, between how we see
- 1:32Speaker 2: and what we understand. The book really emphasizes that the
- 1:36Speaker 2: best visualizations are the ones that kind of tap into
- 1:39Speaker 2: how we intuitively interpret things like size, color, position, makes sense.
- 1:43Speaker 1: Like making the data speak directly through what we see exactly.
- 1:46Speaker 1: So our mission today really is to pull out the
- 1:48Speaker 1: key insights from this book to help you listening become
- 1:52Speaker 1: more data savvy.
- 1:53Speaker 2: Yeah, give you the tools to not just make your
- 1:55Speaker 2: own effective charts, but also to look at any graph
- 1:57Speaker 2: you see and really understand what it's telling you or
- 2:00Speaker 2: maybe what it isn't telling you.
- 2:01Speaker 1: Good point. We want to help you avoid those common
- 2:05Speaker 1: pitfalls and just feel more confident navigating all this data.
- 2:09Speaker 2: Okay, so where should we start? Maybe the big question
- 2:13Speaker 2: why even bother visualizing data? Why not just stick with
- 2:17Speaker 2: the tables.
- 2:18Speaker 1: Right. The book makes a really strong case for moving
- 2:21Speaker 1: beyond just the numbers.
- 2:22Speaker 2: It does. There's a great example from Jackman back in
- 2:27Speaker 2: nineteen eighty.
- 2:27Speaker 1: Oh yeah, the voter turnout one.
- 2:29Speaker 2: That's the one. He was looking at voter turnout and
- 2:32Speaker 2: income inequality across different countries. Okay, and the initial analysis,
- 2:36Speaker 2: just crunching the numbers for eighteen countries suggested a pretty
- 2:40Speaker 2: strong link.
- 2:41Speaker 1: Seems straightforward enough.
- 2:42Speaker 2: But then he just plotted the data a simple scatterplot
- 2:45Speaker 2: and bam, it was instantly clear that whole relationship is
- 2:49Speaker 2: basically being driven by one single data.
- 2:51Speaker 1: Point South Africa.
- 2:52Speaker 2: Wow, so one outlier was creating the entire trend pretty much.
- 2:56Speaker 1: Now, you could find that eventually with more stats, sensitivity analysis,
- 3:00Speaker 1: stuff like that.
- 3:00Speaker 2: Sure, big, deep enough, but the visual.
- 3:02Speaker 1: It made it obvious immediately.
- 3:04Speaker 2: That's a powerful demonstration right there. It really is.
- 3:07Speaker 1: Yeah.
- 3:07Speaker 2: And there's another great illustration of the book, inspired by Enscom's.
- 3:10Speaker 1: Quartet ah the classic.
- 3:12Speaker 2: Yeah. So another researcher, Van Hove, created sixteen different data
- 3:16Speaker 2: sets and here's the kicker. Huh, every single one had
- 3:20Speaker 2: the exact same statistical correlation between x and y r
- 3:25Speaker 2: equals point.
- 3:26Speaker 1: Six Okay, point six seems like a decent positive relationship.
- 3:30Speaker 2: Right, that's what the number tells you. But then you
- 3:33Speaker 2: visualize them. You plot those sixteen data sets, and they
- 3:36Speaker 2: look at different, totally different. Some look like a nice
- 3:39Speaker 2: cloud of points like you'd expect. Others have a crazy
- 3:42Speaker 2: outlier point of the line. Some are clearly curved, some
- 3:45Speaker 2: are just like two separate groups of dots.
- 3:48Speaker 1: So the single number point six completely hid all that
- 3:51Speaker 1: variation completely.
- 3:52Speaker 2: The core insight there is just critical. Yeah, always always
- 3:56Speaker 2: look at a scatterplot of your correlations. Don't just trust
- 3:59Speaker 2: the number.
- 3:59Speaker 1: It really Ammer's home that point, doesn't it. A single
- 4:01Speaker 1: statistic can mask wildly different realities in the data. You
- 4:05Speaker 1: just have to see the shape, spot the weird.
- 4:07Speaker 2: Stuff, understand the distribution.
- 4:09Speaker 1: Yeah, but it's also important, as the book notes, not
- 4:12Speaker 1: to just blindly trust the visual either.
- 4:14Speaker 2: Right. Absolutely, visualizations have their own what the book calls
- 4:18Speaker 2: rhetorical plausibility. They suggest things, They.
- 4:21Speaker 1: Frame the data in a certain way exactly.
- 4:24Speaker 2: Just because it's in a chart doesn't make it the
- 4:26Speaker 2: absolute truth. We still need to think critically.
- 4:28Speaker 1: Okay, so we're sold on why visualization is powerful, But
- 4:32Speaker 1: what makes one good versus bad Right.
- 4:34Speaker 2: The book kind of breaks down the problems into three buckets. Okay,
- 4:38Speaker 2: there's issues of just plain bad taste aesthetics. Then there
- 4:43Speaker 2: are substantive problems like how the data itself is shown,
- 4:47Speaker 2: and finally perceptual problems how our brains interpret the visual.
- 4:51Speaker 1: Let's start with bad taste. What falls into that category?
- 4:54Speaker 2: This is where aesthetics really come in. Things that make
- 4:56Speaker 2: a graph distracting, cluttered, hard to read, inconsistent design.
- 5:01Speaker 1: Choice, What is too much going on?
- 5:02Speaker 2: Yeah? Exactly. The book uses an example figure one point
- 5:05Speaker 2: four of what it calls chart junk, classic term chart junk.
- 5:08Speaker 1: Love it. What's an example?
- 5:09Speaker 2: Oh, think like bars that are hard to distinguish, labels
- 5:13Speaker 2: repeated everywhere pointlessly, Maybe those fake three D effects that
- 5:17Speaker 2: add nothing, oh the worst? Or drop shadows, yes, drop shadows,
- 5:22Speaker 2: pointless textures. It's just visual clutter getting in the way
- 5:25Speaker 2: of the actual data.
- 5:26Speaker 1: So the idea is keep it clean pretty much.
- 5:29Speaker 2: Less is often more. Every little line, every color should
- 5:33Speaker 2: be there for a reason, helping the data speak. If
- 5:36Speaker 2: it's not adding understanding, maybe it shouldn't be there.
- 5:38Speaker 1: It reminds me of Edward Tuff's work. The book mentions him, right.
- 5:41Speaker 2: Oh, yeah, Tuft's foundational his concept of the data to
- 5:44Speaker 2: ink ratio.
- 5:45Speaker 1: Right, maximize the ink that shows data, minimize the rest.
- 5:48Speaker 2: Exactly, get rid of the chart junk. He also talked
- 5:50Speaker 2: about graphical excellence, showing interesting data clearly, efficiently, telling the
- 5:55Speaker 2: truth about it, getting the most ideas across with the
- 5:58Speaker 2: least visual noise.
- 5:59Speaker 1: Makes sense, simplify, remove extra gridlines, pointless colors.
- 6:04Speaker 2: Usually yes, But the book throws in a really interesting
- 6:08Speaker 2: curveball here. Some research Bateman Borkin, they found that sometimes
- 6:13Speaker 2: those more visually embellished graphs, almost like many infographics, Yeah,
- 6:17Speaker 2: they can actually be more memorable than the super simple,
- 6:20Speaker 2: clean ones.
- 6:21Speaker 1: Really, that's counterintuitive, more memorable even if they're harder to
- 6:25Speaker 1: read initially.
- 6:26Speaker 2: It seems so. Yeah, people might recall something visually unique
- 6:29Speaker 2: or novel more easily later on.
- 6:31Speaker 1: Huh. So there's a bit of a trade off maybe
- 6:33Speaker 1: between immediate clarity and long term.
- 6:35Speaker 2: Recall potentially, But the key is memorable doesn't automatically mean
- 6:41Speaker 2: easy to interpret.
- 6:42Speaker 1: Accurately, right, which brings us to that third category of problems,
- 6:46Speaker 1: perceptual issues exactly.
- 6:48Speaker 2: This is where it gets really fascinating. Even a clean,
- 6:51Speaker 2: well designed graph can unintentionally mislead people just because of
- 6:56Speaker 2: how our brains work. How so well? The book shows
- 6:59Speaker 2: an example with stacked bar charts, trying to compare the
- 7:02Speaker 2: size of the say, middle segment, across several different bars.
- 7:06Speaker 2: It's surprisingly difficult for our eyes.
- 7:08Speaker 1: Yeah, I can picture that your baseline keeps changing, right.
- 7:11Speaker 2: And there's another example with lines that look like they're
- 7:13Speaker 2: converging getting closer just because of the aspect ratio the
- 7:17Speaker 2: shape of the plot, even if the underlying data shows
- 7:20Speaker 2: they're staying parallel.
- 7:21Speaker 1: Wow, So good taste isn't enough. You really need to
- 7:24Speaker 1: understand perception.
- 7:25Speaker 2: You absolutely do. And our perception is a uniform right,
- 7:28Speaker 2: Like how we see color. Our ability to distinguish shades
- 7:32Speaker 2: changes across the spectrum.
- 7:34Speaker 1: And it depends on lightness too, doesn't it.
- 7:36Speaker 2: Yeah, chroma depends on luminance. It gets complex. That's why
- 7:39Speaker 2: the book really pushes for using perceptually uniform color palettes.
- 7:44Speaker 1: Perceptually uniform, Okay, what does that mean?
- 7:46Speaker 2: Exactly? Imagine a color ramp where each step up represents
- 7:49Speaker 2: an equal increase in the data value. A perceptually uniform
- 7:53Speaker 2: palette makes those steps look equally spaced in color intensity.
- 7:57Speaker 1: Ah, so a non uniform one might make some small
- 8:00Speaker 1: data changes look huge visually or vice versa.
- 8:03Speaker 2: Exactly, it avoids accidentally emphasizing or de emphasizing parts of
- 8:08Speaker 2: the data just because of quirks in the color scale.
- 8:11Speaker 1: Okay, so the book talks about different types of these palets.
- 8:14Speaker 2: Yeah, three main ones. First, sequential scales, think lo to
- 8:18Speaker 2: high data like income or maybe temperature if it's all positive.
- 8:22Speaker 1: Makes sense, like light blue to dark blue.
- 8:25Speaker 2: Right. Then you have diverging scales. These are for data
- 8:28Speaker 2: with a meaningful midpoint like zero temperature changes, maybe deviations
- 8:33Speaker 2: from an average.
- 8:33Speaker 1: Like that blue to red scale example figure one point.
- 8:36Speaker 1: Then you see that's a.
- 8:37Speaker 2: Classic zero or the midpoint is usually a neutral color
- 8:41Speaker 2: like white or light gray, and the extremes diverge to
- 8:44Speaker 2: two different hues.
- 8:45Speaker 1: Okay.
- 8:45Speaker 2: And third type qualitative talents. These are for categorical data
- 8:50Speaker 2: where there's no inherent order. Think countries, talks of products,
- 8:53Speaker 2: political parties.
- 8:54Speaker 1: So the goal there is just distinct colors distinct.
- 8:58Speaker 2: But also ideally with similar visual weight, so one category
- 9:02Speaker 2: doesn't just pop out unintentionally. The bottom palette that same
- 9:05Speaker 2: figure one point one end scene is a good example.
- 9:07Speaker 1: It's really about making sure the visual differences match the
- 9:10Speaker 1: data differences accurately precisely.
- 9:12Speaker 2: Using the wrong palate can really mess with interpretation.
- 9:15Speaker 1: The book also mentions complexity overload trying to map too
- 9:18Speaker 1: many things at once.
- 9:19Speaker 2: Yeah, like using size and shape and color and position
- 9:23Speaker 2: all in one go. Unless the data has a really
- 9:26Speaker 2: really clear structure, it just becomes noise. Figure one point
- 9:29Speaker 2: nineteen shows that, Well, hard to track everything.
- 9:32Speaker 1: Too much happening. And what about gestalt rules?
- 9:35Speaker 2: Ah, yeah, that's about how our brains naturally look for patterns.
- 9:39Speaker 2: We group things, we connect things. We see shapes even.
- 9:42Speaker 1: If they aren't really there sometimes like seeing faces in clouds,
- 9:45Speaker 1: kind of like that.
- 9:46Speaker 2: Yeah. Figure one point one each shows seemingly random dots,
- 9:50Speaker 2: but you can't help trying to see clusters or lines.
- 9:53Speaker 2: This is powerful if you use it right in visualization design,
- 9:56Speaker 2: but it can also trick people into seeing patterns that
- 9:58Speaker 2: are just random chance.
- 10:00Speaker 1: So understanding perception is crucial, which leads to how we
- 10:03Speaker 1: actually encode data visually. The book talks about Cleveland and
- 10:06Speaker 1: McGill's research foundational stuff.
- 10:08Speaker 2: Figure one point two to three summarizes it. They basically
- 10:11Speaker 2: figured out what visual tasks were best at?
- 10:13Speaker 1: Perceptual Okay, what's at the top. What are we best at?
- 10:16Speaker 2: Judging position along a common scale? Think comparing bar heights
- 10:20Speaker 2: in a standard bar chart. We're really accurate.
- 10:23Speaker 1: At That makes sense, they all start from zero, right.
- 10:25Speaker 2: Then comes position on a lined but separate scales. Still
- 10:29Speaker 2: pretty good. Then judging links like line segments, but only
- 10:34Speaker 2: if they share a common baseline.
- 10:36Speaker 1: Hmm. Okay, and what are we worse at?
- 10:38Speaker 2: Our accuracy drops off for judging links without a common baseline.
- 10:43Speaker 2: Then things like angles, which is why pie charts can
- 10:46Speaker 2: be problematic for comparison in area and volume and color
- 10:50Speaker 2: saturation or hue are further down the list.
- 10:53Speaker 1: So this hierarchy should guide our choices. If you want
- 10:56Speaker 1: people to compare values accurately, use.
- 10:58Speaker 2: Position along the commons. Bar charts are often great for that.
- 11:02Speaker 2: If you're showing trends, maybe line charts work well for
- 11:04Speaker 2: judging slope or angle, though even that's not top tier.
- 11:07Speaker 1: It really highlights why choosing the right chart type matters
- 11:10Speaker 1: so much for effective communication. It's about how easily the
- 11:13Speaker 1: viewer can decode the information exactly, and.
- 11:16Speaker 2: The book also stresses it's not just which channel you
- 11:19Speaker 2: choose like color or position, but how you implement.
- 11:22Speaker 1: It, like using a good sequential palette for ordered data
- 11:25Speaker 1: or distinct hues for categories.
- 11:27Speaker 2: Precisely the details of the implementation matter hugely.
- 11:30Speaker 1: Okay, this is great theory, but the book is also
- 11:32Speaker 1: very practical. Right it dives into using R and gg
- 11:36Speaker 1: plot two.
- 11:36Speaker 2: It does it shift skiers into how you actually make
- 11:39Speaker 2: these visualizations using code.
- 11:41Speaker 1: Now, programming can sound a bit scary. The book suggests
- 11:44Speaker 1: starting with something called R mark down. Why is that helpful?
- 11:47Speaker 2: Armarkdown is fantastic for reproducibility unless you combine your code,
- 11:51Speaker 2: your notes, and your output the plots, the tables all
- 11:54Speaker 2: in one document.
- 11:55Speaker 1: So you can see exactly how you got a result exactly.
- 11:58Speaker 2: You write in plaintext embedchun of our code. When you
- 12:01Speaker 2: process the document, the code runs and the results get
- 12:04Speaker 2: inserted right there. It's great for keeping track, sharing work,
- 12:07Speaker 2: and avoiding that how do I make this chart again?
- 12:09Speaker 1: Problem? That sounds incredibly useful and R itself.
- 12:13Speaker 2: R is a super powerful language widely used in statistics
- 12:16Speaker 2: and data science, and gg plot two is this amazing
- 12:19Speaker 2: package within R for visualization.
- 12:21Speaker 1: Built on the grammar of graphics what's that about.
- 12:24Speaker 2: Think of it like a system for building graphs piece
- 12:26Speaker 2: by piece. You start with your data, then you define
- 12:30Speaker 2: esthetic mappings linking data variables to visual properties like exposition,
- 12:34Speaker 2: we position, color size.
- 12:37Speaker 1: Okay, mapping data to visuals.
- 12:39Speaker 2: Then you choose gms to the geometric objects like points, lines,
- 12:42Speaker 2: bars that actually represent the data, and you layer these
- 12:44Speaker 2: things together.
- 12:45Speaker 1: So it's a structured way to think about building any
- 12:47Speaker 1: kind of.
- 12:47Speaker 2: Plot exactly, very flexible, very powerful once you grasp the
- 12:51Speaker 2: core ideas developed by Leland Wilkinson implemented in gig plot
- 12:55Speaker 2: two by Hadley Wickham.
- 12:57Speaker 1: And the book mentions the ecology of assistance better.
- 13:00Speaker 2: Now Yeah, basically meaning there's just so much help available
- 13:03Speaker 2: online now, websites like stack overflow, our communities, tutorials, blogs,
- 13:08Speaker 2: it's much easier to get started in financewers. When you
- 13:10Speaker 2: get stuck then it used to.
- 13:11Speaker 1: Be that's encouraging. So to get started, the book says,
- 13:14Speaker 1: install the tidy verse right.
- 13:17Speaker 2: The tidy Verse is a collection of our packages including
- 13:20Speaker 2: deep plot two, deeplier for a data manipulation, and others,
- 13:23Speaker 2: all designed to work together really well. You install it
- 13:26Speaker 2: in our studio usually with just installed out packages.
- 13:29Speaker 1: Tidy verse, and the book suggests typing out the examples.
- 13:33Speaker 2: Yeah, it's good advice. Actually typing the code helps it
- 13:35Speaker 2: sync in much better than just copy pasting.
- 13:37Speaker 1: Good tip and reassuringly. Gplot's defaults are pretty.
- 13:41Speaker 2: Good generally, Yes, the default settings for colors, themes, et
- 13:46Speaker 2: cetera are thoughtfully chosen. You can often get a decent
- 13:49Speaker 2: looking informative plot without much tweaking, which is great for beginners.
- 13:53Speaker 1: Okay, let's get into those core jiggy plot concepts. First,
- 13:56Speaker 1: ascetic mappings using ease. Break that down again.
- 13:59Speaker 2: Right. Ease is where you tell gd plot which variables
- 14:02Speaker 2: in your data control which visual property. So as x
- 14:05Speaker 2: gdt per cap y equals life x, color equals the
- 14:10Speaker 2: x axis, life x controls the I axis, and the
- 14:13Speaker 2: continent column controls the color.
- 14:15Speaker 1: Crucially, you're not saying which color, just what controls the
- 14:17Speaker 1: color exactly.
- 14:18Speaker 2: Gb plot handles assigning the actual colors, positions, et cetera
- 14:22Speaker 2: based on the data values.
- 14:23Speaker 1: Okay, then GMS GMS.
- 14:25Speaker 2: Are the visual markers. Geompoint makes a scatterplot, gmline draws lines,
- 14:29Speaker 2: GMAM makes bar shirts. Gmsmooth adds a smooth trend line
- 14:33Speaker 2: you add into your plot with a plus sign.
- 14:35Speaker 1: So ggplot sets up the canvas and mappings. Then you
- 14:38Speaker 1: add plus gom point or plus gmbi.
- 14:41Speaker 2: You got you build plots layer by layer.
- 14:43Speaker 1: And the importance of tidy data. Ah.
- 14:45Speaker 2: Yes, tidy data is a way of structuring your data
- 14:48Speaker 2: set that ggplot and the tidy verse really prefer. Basically,
- 14:52Speaker 2: each variable gets its own column, each observation gets its.
- 14:55Speaker 1: Own row like a long format, not wide exactly.
- 14:58Speaker 2: It might seem like a small detail, but organizing your
- 15:01Speaker 2: data this way makes working with gdplot much much smoother
- 15:04Speaker 2: and more intuitive.
- 15:05Speaker 1: Got it? And this idea of inheritance of mappings.
- 15:08Speaker 2: That just means if you define mappings in the main
- 15:10Speaker 2: gd plot call like g plot data gapminder asex c
- 15:15Speaker 2: GDP per cap y life x, any gms you add
- 15:18Speaker 2: later like plus gom point or plus gm smooth will
- 15:20Speaker 2: automatically use those x and y mappings.
- 15:22Speaker 1: Unless you override them specifically in the GM right.
- 15:25Speaker 2: You can give a GM its own a's mapping if needed,
- 15:28Speaker 2: but inherence saves a lot of typing for common mappings.
- 15:31Speaker 1: Okay, let's run through some practical plot examples from the
- 15:33Speaker 1: book Basic Scatterplot Life expectancy versus GDP per capita using
- 15:37Speaker 1: the gapminder data YEP.
- 15:39Speaker 2: That would be gg plot data gapminder mapping es x
- 15:43Speaker 2: GDP per cap y lifex that sets it up plus
- 15:46Speaker 2: g ome point boom scatterplot simple enough. Add a smoother
- 15:50Speaker 2: Just add plus GM smooth. On the next line. Gg
- 15:52Speaker 2: plot adds a default trend line, usually with a confidence
- 15:56Speaker 2: band around it.
- 15:56Speaker 1: Nice. Now that GDP data is probably skewed right of
- 16:00Speaker 1: lower values a few very high ones.
- 16:01Speaker 2: Usually is makes the scatterplot bunch up on one side.
- 16:05Speaker 1: So transforming the scale like a log scale for the
- 16:08Speaker 1: X axis good idea.
- 16:09Speaker 2: Yes, add another layer plus scale x log ten that
- 16:13Speaker 2: transforms the x axis to a base ten log scale,
- 16:16Speaker 2: spreading the data out much better.
- 16:17Speaker 1: Visually okay, and making it look more professional. Titles axis
- 16:20Speaker 1: labels use.
- 16:21Speaker 2: The labs function add plus lab title my plot title
- 16:25Speaker 2: x GDP per capita why life expectancy.
- 16:27Speaker 1: Simple and what if you want to format the axis
- 16:30Speaker 1: labels like showing dollars on the X axis.
- 16:32Speaker 2: That's where the scales package comes in Handy You modified
- 16:35Speaker 2: the scale function maybe like plus scale x log ten
- 16:38Speaker 2: labels at cool scales dot dollar gives you a nice
- 16:40Speaker 2: dollar formatting Cool.
- 16:42Speaker 1: Now, what about mapping categories like coloring the points by continent.
- 16:46Speaker 2: You add color continent inside the a's function, so as
- 16:50Speaker 2: xx GDP per cap y life x color.
- 16:53Speaker 1: Continent and ggplot handles the rest YEP.
- 16:56Speaker 2: It assigns a color to each continent and automatically adds
- 16:58Speaker 2: a legend explaining the colors. If you also have GM smooth,
- 17:02Speaker 2: you'll likely get a separate smooth line for each continent
- 17:05Speaker 2: in its corresponding color.
- 17:07Speaker 1: Okay, this brings up that crucial difference mapping versus setting
- 17:11Speaker 1: making all points purple.
- 17:12Speaker 2: For instance, right, if you put color purple inside a's
- 17:16Speaker 2: fod G plot treats purple as a data value, it
- 17:19Speaker 2: gives all points the same default color and makes a
- 17:22Speaker 2: useless legend entry.
- 17:23Speaker 1: For purple because you mapped it to data.
- 17:25Speaker 2: Exactly, If you just want to set all points b purple,
- 17:27Speaker 2: you put color purple outside a's inside the GM function
- 17:30Speaker 2: itself like GM point color purple.
- 17:33Speaker 1: No mapping, just setting a fixed visual property, no legend needed.
- 17:37Speaker 2: Precisely, huge difference. Common point of confusion makes sense.
- 17:41Speaker 1: Then there's faceting, splitting the plot into panels.
- 17:44Speaker 2: Yes, super useful. Face wrap lets you split by one
- 17:47Speaker 2: categorical variable, arranging panels and a grid face. A grid
- 17:51Speaker 2: lets you split by two variables, creating a two D
- 17:54Speaker 2: grid of plots like.
- 17:55Speaker 1: That age versus children example, faceted by sex and.
- 17:59Speaker 2: Race exactly to compare relationships across different groups really effectively.
- 18:03Speaker 1: What about visualizing just one continuous variable?
- 18:06Speaker 2: Histograms EM histogram you map your variable to x like
- 18:10Speaker 2: a x use area. It bins the data and shows
- 18:13Speaker 2: counts as bars. You might need to adjust the binwith
- 18:16Speaker 2: argument to get a good view. Or density plots GEM
- 18:18Speaker 2: density similar idea, but gives you a smooth curve estimated
- 18:21Speaker 2: distribution often a nice alternative or complement to histograms.
- 18:25Speaker 1: And briefly, graph tables.
- 18:27Speaker 2: GM table allows embedding a small table right onto the plot.
- 18:30Speaker 2: Can be handy for showing summary stats alongside the visual.
- 18:33Speaker 1: Okay, crucial step saving your masterpiece? How do we save plots?
- 18:37Speaker 2: Easiest way is DG save After you display your plot
- 18:40Speaker 2: to type gg stave myplot dot pdf or gg save
- 18:43Speaker 2: myplot dot PNG. It saves the last plot by default.
- 18:46Speaker 1: PDF versus PNG you mentioned, vector versus raster.
- 18:49Speaker 2: Yeah. Vector formats like PDF or SVG are usually best.
- 18:53Speaker 2: They store the plot as lines and shapes, so you
- 18:56Speaker 2: can resize them infinitely without getting blurry. Good for publications.
- 19:00Speaker 1: Raster formats like PNG or JPEG are pixel based, so
- 19:04Speaker 1: they can get blocky if you enlarge them too much.
- 19:06Speaker 2: Right, use vector when you can, especially for line art
- 19:09Speaker 2: like most plots, and.
- 19:10Speaker 1: The here package for filepaths.
- 19:12Speaker 2: Highly recommend it. It helps make your filepaths relative to
- 19:15Speaker 2: your project root directory, so your code doesn't break if
- 19:18Speaker 2: you move the project folder or share it. Much more
- 19:20Speaker 2: robust dot here, dot here output my plot dot pdf
- 19:24Speaker 2: kind of thing, okay. Chapter five delves into refining plots.
- 19:28Speaker 2: Key takeaways main things.
- 19:30Speaker 1: Every aesthetic mapping has a scale scale dot function you
- 19:34Speaker 1: can adjust like tics. Labels, sales often have guides legends
- 19:38Speaker 1: you can tweak.
- 19:38Speaker 2: With guides and cosmetic changes.
- 19:40Speaker 1: Often done in the GM function itself or using the
- 19:42Speaker 1: big theme function for overall plot appearance, background, gridlines, fonts,
- 19:46Speaker 1: legend position.
- 19:47Speaker 2: Right like theme, legend dot position, a bottle and labs
- 19:50Speaker 2: for all labels YEP labs it's your friend for access titles,
- 19:54Speaker 2: legend titles, plot titles, subtitles, captions keep things clearly labeled.
- 19:58Speaker 1: Moving on, Chapter six touches on visualizing models, not just
- 20:02Speaker 1: raw data.
- 20:03Speaker 2: Yeah, visualization is huge for understanding modern results too. The
- 20:06Speaker 2: Broom package is amazing here. How so it tidies up
- 20:09Speaker 2: MESSI model output. Tidy gives you coefficients, p values, et cetera,
- 20:13Speaker 2: and a nice table augment adds predictions and residuals back
- 20:17Speaker 2: to your original data. Glance gives model summary stats.
- 20:20Speaker 1: So you can then plot those Tidy results exactly.
- 20:22Speaker 2: You can plot coefficients using packages like cofplot. You can
- 20:25Speaker 2: generate predictions from your model using predict, then plot those predictions,
- 20:28Speaker 2: maybe with confidence intervals using gn Ribbon mixed models much
- 20:32Speaker 2: less abstract.
- 20:33Speaker 1: Chapter seven maps another visual form, but with unique issues.
- 20:37Speaker 2: Definitely, maps are tricky. Data is often tied to geographic
- 20:41Speaker 2: units of varying sizes and populations, the modifiable aerial unit problem.
- 20:45Speaker 1: Like how election maps can look different depending on whether
- 20:48Speaker 1: you color states or counties or scale by population.
- 20:51Speaker 2: Precisely, the book shows that twenty sixteen election maps illustrating this.
- 20:56Speaker 2: It also stresses looking at baseline variables like population density
- 21:00Speaker 2: when interpreting coreplith maps maps colored by value.
- 21:04Speaker 1: Right, because a large, sparsely populated area colored dark red
- 21:08Speaker 1: might represent fewer actual votes than a small dense area
- 21:11Speaker 1: colored lighter.
- 21:12Speaker 2: Red exactly, gotta be careful with interpretation.
- 21:15Speaker 1: Chapter eight gets back to color importance of colorblind friendliness crucial.
- 21:20Speaker 2: About eight percent of man have some form of color
- 21:22Speaker 2: vision deficiency. Use palettes designed to be distinguishable for everyone.
- 21:27Speaker 2: Packages like Dichromat and color Blinder help with this in.
- 21:30Speaker 1: R good point and using manual colors when they have
- 21:32Speaker 1: meaning like political parties, can be useful.
- 21:35Speaker 2: But the book cautions against stereotypes. Always test and themes. Themes.
- 21:39Speaker 1: Themes are great for changing the whole look and feel quickly.
- 21:41Speaker 1: UG themes has presets like them Economist or the Musejay,
- 21:45Speaker 1: or you can customize endlessly with the base theme function.
- 21:48Speaker 2: Chapter eight also warns about some plot types dual y axes,
- 21:52Speaker 2: yet generally avoid dual y ax as if possible, very
- 21:55Speaker 2: easy to mislead by manipulating the axis ranges independently. The
- 21:59Speaker 2: book suggests alternatives like indexing data to a common start
- 22:02Speaker 2: point or plotting the difference.
- 22:04Speaker 1: And the perennial favorite target.
- 22:06Speaker 2: Pie Charts ha yes generally poor for comparisons, especially if
- 22:11Speaker 2: they are many slices or the values are close. Board
- 22:13Speaker 2: charts are almost always better for showing parts of a
- 22:16Speaker 2: whole or comparing amounts.
- 22:17Speaker 1: Okay, Finally, the appendix emphasizes reproducibility and workflow super important.
- 22:22Speaker 2: Use R marked out, keep your data tidy, write functions
- 22:25Speaker 2: for repetitive tasks, know how to find help using i'm
- 22:29Speaker 2: and package vignettes in R. It makes your analysis more reliable, understandable,
- 22:34Speaker 2: and repeatable.
- 22:35Speaker 1: So wrapping up data visualization is incredibly powerful for insight.
- 22:39Speaker 2: But it requires thought, understanding, perception, design principles, honest representation, and.
- 22:44Speaker 1: Tools like R and gg plot two as the book shows,
- 22:47Speaker 1: give you the practical means to do it well.
- 22:49Speaker 2: Absolutely hopefully you the listener feel a bit more ready
- 22:52Speaker 2: to dive in and visualize your own data.
- 22:54Speaker 1: Yeah, those aha moments when you see a pattern are
- 22:57Speaker 1: really rewarding.
- 22:58Speaker 2: Definitely, and don't be intimidated by the learning curve. The
- 23:01Speaker 2: resources and community support are really strong.
- 23:03Speaker 1: Now, So here's a thought to leave you with. Think
- 23:06Speaker 1: about the last confusing chart you saw, How could some
- 23:09Speaker 1: of these ideas, clarity, perception, honesty have made it better?
- 23:13Speaker 2: And maybe more importantly, what stories are hiding in your
- 23:16Speaker 2: data waiting to be visualized.
- 23:18Speaker 1: We really encourage checking out the book Data visualization, a
- 23:21Speaker 1: practical introduction and exploring those R packages tidy Verse, GG
- 23:26Speaker 1: plot two, scales here, gg themes, Broom, lots of great tools.
- 23:30Speaker 2: Pause, remember looking at data, visualizing it. It's not a
- 23:34Speaker 2: substitute for thinking carefully
- 23:36Speaker 1: Right, but it's an absolutely essential part of asking better
- 23:39Speaker 1: questions and getting to those deeper insights.