Resources

William Chase | The Glamour of Graphics | RStudio (2020)

I see a lot of ugly charts. This is to be expected as I work with a lot of academics and data scientists, neither of whom have been trained in how to design attractive charts. I myself produced many ugly charts during my years as a research scientist, when the design process basically came down to random tweaking until things "looked good". If only I could go back and tell young inexperienced me that there was a better way. In this talk, I will present that better way--a series of design principles that can take any chart from drab to fab. Rather than applying these techniques willy nilly, I will show how they form a layered "Glamour of Graphics" that is structured and can be easily applied to any chart. This Glamour of Graphics has some simple implementations in ggplot, where we will replace geoms, aesthetics, and scales with typography, color, and layout. Finally, I will discuss why looks matter when it comes to charts, and how by following the Glamour of Graphics you can design charts that are more persuasive and more accurately perceived

image: thumbnail.jpg

Transcript#

This transcript was generated automatically and may contain errors.

So, without further ado, I'd like to introduce our first speaker, Will Chase, speaking on The Glamour of Graphics.

Alright, so, thank you for coming today, everyone, and welcome to my talk on The Glamour of Graphics, which is a talk on the design of charts. So if you recognize me, it's probably from Twitter. I tweet excessively, and you may also recognize my website, williamrchase.com, where I post lots of blogs about art and generative art, how to make it an R, R tutorials, all sorts of stuff like that.

So professionally, I come from academia. I worked at Penn State and then UPenn for many years, and now recently I've joined Fidelity Investments as a senior visualization analyst, where I'm focusing on visual design and storytelling within our organization. I also do freelance data visualization, so if you're interested in talking about that, please get in touch.

Now, The Glamour of Graphics that I'm going to be talking about today was actually inspired by Kelly Bodwin. As I say, I tweet excessively, so this is where I got the inspiration, and that led me to spend one of my Saturdays making this Glamour Magazine spoof, which I think was probably my most viral tweet ever, and I may be the first person to get invited to talk at RStudioConf based on a Twitter meme that I made, so I'm pretty proud of that. But I think that there's actually some substance here. So this said take your charts from drab to fab, and that's sort of what we're going to try to do today.

So this is the drab. This is the starting point, right? But it's true. And what we're going to try to do is get something more like this. So a little bit about what this talk is not. It's not a talk about chart shaming, so you'll see a lot of design mistakes that I'm going to talk about today, but if you go to my blog and look at my portfolio, you will see all of those mistakes featured heavily there. It's also not a talk about tools or about what charts to use in terms of data visualization. It's really focused on the aesthetics.

So the reason you should care about aesthetics and charts is pretty obvious to me, but it will help you engage a much wider audience with your work. It'll actually help your work to be perceived as more usable and more intuitive. So it's actually been shown that charts that are more aesthetically pleasing are perceived by users to be more intuitive. And finally, it'll just let you show respect for your audience. People spend their time looking at your charts. You should spend time making them look nice.

So when I started researching this, I thought it was sort of just a coincidence. So grammar of graphics, glamour of graphics, ha ha. But it turns out that the word glamour is actually derived from the word grammar. So back in the Middle Ages, the word grammar meant all learning, and that included things like magic and occult. And through the ages, that word sort of morphed into glamour, and as it did, it lost the association with knowledge, and it became to mean just a magical spell, actually. And then eventually in the 18th century, the idea of magic sort of washed away a little bit and we got the meaning that we know today, which is this sort of exciting, illusory, romantic attractiveness.

So the grammar of graphics is a tool that enables us to concisely describe the components of a graphic. And what I'm going to do today is try to bring this sort of illusory, romantic quality of glamour a little bit closer to a grammar. So I'm going to describe a tool that enables us to concisely describe the design of a graphic. So in the grammar of graphics, we have these three components of data, aesthetics, and geometries that are really the core of any chart. And I know there's more layers, but this is really the core of how to describe a chart. What I'm going to describe in the glamour of graphics is similar, but I'm going to describe three layers that you need to describe the design of a graphic, and that's the layout, the typography, and the color.

Layout: alignment, white space, and clutter

So beginning with layout, I'm going to talk about three main concepts today, and that is alignment, white space, and grids, lines, and borders. So beginning with alignment, I want to talk about titles first. Titles should be top-left aligned, usually. And when I say top-left aligned, I don't mean the case that you see on the left where you have left-aligned with your data. I mean left-aligned all the way to the edge of your chart to create a nice, clean line with the edge of your chart.

Now, previously, this was actually kind of tricky to do with ggplot, but luckily in the development version, we have a new argument that makes this very, very simple to do. Next, I want you to please not make me do, like, this when I read your chart. So I see this a lot of times, especially in academic graphics, where you have these really long X-axis labels. Nobody wants to do that. So of course, it's always better if you can to flip our coordinates horizontally, or if you can't manage to flip it, you can just try to make the text horizontal by increasing your spacing and such.

This is a little more controversial, maybe, but I also think it's actually best practice not to use vertical axis labels, because you have the same problem. So you can do the same thing. You can try to make the text just horizontal, or a lot of times, you can get rid of axis labels entirely. A lot of axis labels are completely unnecessary. Things like dates, in this case, SUV, minivan, it's obvious these are types of cars. And usually by just including a good title, you can do away with axis labels.

So when you're thinking about alignment, you should always try to create clean lines and symmetry. And what I want to go over is a little bit, this graphic from 538 that I think really illustrates some of these points. So this doesn't have big blocks of text, but just to mention, if you do have big blocks of text, like an infographic or something, you want to left align those, most likely. Left alignment should sort of be your default. Right alignment can be used for labels a lot of times, so especially like horizontal bar labels, where the goal is to create a clean line with the edge of your data. And sometimes subtitles or labels can be center aligned if it helps to create symmetry within the graphic.

So in this case, you can see, actually, the designer made a mistake on the 2014 one. It should be center aligned, but it's slightly off center. But if you look at the rest of the graphic, you can see how this left alignment, right alignment, and center alignment sort of creates this perfect symmetry within the graphic.

So charts often come with these extraneous elements. They're not data, and a lot of times they can distract from the chart. So I want to talk a little bit about how to reduce those. A good example of this is borders. You almost never need a border in a chart. Oftentimes they just don't serve a purpose, and all they do is distract from your data, and add ink to the page. Another thing is gridlines. I understand that there's reasons to have gridlines sometimes, but I encourage you to always question the purpose of every gridline. Do you need horizontal gridlines in every case? Do you need minor gridlines? If not, please remove them. If you do need them, I encourage you to make them as light and as small as possible so that they sort of disappear into the background rather than distracting from your data.

Another thing that distracts from your data a lot is legends, particularly when you have like a big blob of a legend off to the right-hand side of your chart. It's not a very good flow within your chart. So I recommend if you have legends, you put them right below the titles where it creates a nice flow with your chart. A better solution even is to directly label your data. Or my favorite solution is to use colored text to indicate your legend in the title. And this will now be possible with the new grid text package, which I think Klaus is talking about this afternoon.

So a few words about whitespace. This is particularly relevant when you're looking at things like dashboards and infographics where you're laying out a lot of charts together. And what I often see is people want to cram as much information as they can possibly get onto the page. But what that ends up resulting in is that you can't even understand any of it. Your eye has no idea where to go on the page. And so your charts really need room to breathe. So I always recommend it's like garlic. You take as much whitespace as you think you need and then triple it.

You take as much whitespace as you think you need and then triple it.

Typography

So that's sort of the foundation of building a nice chart is the layout. And next up I'm going to talk about typography. So typography is a very sort of vast subject. It has a lot of details in it. And I can't cover them all today. But what I highly, highly recommend you do is go to practicaltypography.com. This is a completely free open source online book that will basically teach you everything you could need to know about typography in a very concise way. It will take about three hours to read cover to cover and it will vastly improve the design of everything that you write.

But I do want to touch a little bit on fonts, hierarchy, and a couple of data specific concerns. The font that you choose really matters in a chart. It especially affects the tone of your graphic, right? You can send a completely different message based on the font you choose. And it can also really affect the legibility of your graphic, right? It's pretty easy to have misunderstandings if you choose the wrong font.

And the unfortunate thing is that most people will just go for the system font. The default font. And that's sad because most system fonts are pretty terrible, I'm sorry to tell you. Most of them were designed for the screens that we had in the 1990s, which were all pixelated and terrible. And on modern screens, they look pretty ugly. So if you're a professional organization, you might buy a professional font. But for most of you in the room, you'll probably be looking at free fonts. And the good news is that in 2020, we have a wealth of wonderfully designed beautiful free fonts available easily at fonts.google.com. These are some of my favorites for data visualization. I really like the Source family. It has a Sans Serif variety, Serif variety, monospaced variety, and they're all available in lots of weights and sizes.

So next I want to touch a little bit on hierarchy, a typographic hierarchy. So a typographic hierarchy is just a way of encoding an order of importance in your type that helps to navigate your readers through your chart or through your document. And there's several ways to create hierarchy. So this is a case where we have none. The easiest way to create hierarchy is with size. You can also do it with font weight, with color, with spacing. You can do it with a contrasting typeface. Or ideally a combination of all of these things. And learning the rules of how to create a hierarchy, you know, what should you make your title versus your subtitle versus your body text is just a skill that takes a little bit of practice. But there are some more specific tips in the Practical Typography book that I mentioned earlier.

And finally I want to talk about numbers a little bit. So we use numbers all the time in data visualization. Some fonts have what's called old style numbers. I recommend you not use these. Most of those fonts will also have lining numbers, which have all the same X height. And in a similar vein, you also want to choose a font that has tabular numbers. Tabular numbers all have the same width. So that when you make a table or something, everything will line up in a nice perfect column.

Color

So having covered the layout and the typography of a chart, I want to talk a little bit about the color. Everyone's favorite topic. So there's a lot of tools out there I know. People are probably familiar with things like Color Brewer and there's other R packages that will basically just choose a color for you. Choose a color palette for you. What I want to do today is try to give you a little bit of information that will hopefully help you to choose your own color palettes. The truth is, though, that color is really hard. So I don't want to lie to you and tell you it's going to be easy. It's something I still struggle with. And it's just such a complex subject that it takes a lot of practice. But I think there are a few things that I can tell you today about color theory and then a few sort of practical tips to help improve your usage of color.

So one of the chief complaints I get from people is they say, I just don't know what colors look good together. How do I know what looks good together? This is a case where the color wheel can really help you. So the color wheel, like we all know from grade school, it looks like this. And there's several types of palettes you can choose from the color wheel that will usually have colors that go well together. So if you want to choose a high contrast palette, you can choose a complementary one. That means opposite sides of the color wheel. You can also choose analogous color palettes, which all come from the same side of the color wheel. And there's triadic, which are sort of laid out in a triangle like this. And there's several other color palettes as well. There's split complementary, quadratic, and lots of others. And you can read a little bit more about sort of the feeling that all these color palettes give you. But this is a nice way to sort of get started if you're looking to choose some hues.

So once you choose those, you might want to adjust your colors a little bit. And I want to highlight the HSL color space. So this is a way of describing color in contrast to something like RGB. HSL stands for the hue, saturation, and lightness of a color. So the hue is the actual color itself, red, green, blue. The saturation is the amount of color you have there. And the lightness is how light or dark a color is. So this is an example where we have a red hue. And if we turn down the saturation, you can see that it will basically drain all the color out of there. If we turn up the saturation, it's going to become very rich and vibrant. And if we turn down the lightness, we can see we still have a richness here, but now it's much darker. And if we turn it up, it'll become more lighter, obviously. But you can see how this is a very easy way when you pick a color and you say, oh, but I wish it were a little bit lighter or a little bit more saturated or less saturated. This is a much more intuitive mental model, I think, of how to adjust your colors. And there's lots of online tools you can use where you can stick it in and it'll allow you to adjust the sliders a little bit for your saturation and lightness and such.

So that was a little bit of the color theory. Now some of the practicalities of how I choose color. So I'm sort of a color pirate. I use my favorite tool in the world all the time, which is the eyedropper tool. So this is a tool, if you're not familiar, it's present in all kinds of design programs and you can get apps on your computer. On my Mac, I like to use one called Color Slurp. On Windows, I like Instant Eyedropper, where you can just click the tool, pick any pixel on your screen, and it'll return the color for you. So I use this all the time if I see a data visualization, for example, that I really like where I love the color palette, I'll just take my eyedropper, pick those colors. I do this with websites, with photographs, and then I use the HSL sliders to adjust the colors afterwards.

A good example of this is this generative conference badge that I designed this summer. And I got the inspiration from my mom's day planner. So I went to visit my parents and saw this day planner and I really liked it, so I just took a picture of it. And when it came time to design the graphic, I took my eyedropper tool, picked all the colors I liked, adjusted them a little bit with the HSL sliders, and then had my color palette.

And finally, I want to talk a little bit about backgrounds. So one thing I actually like a lot about the default ggplot theme is that it doesn't use a white background. White backgrounds are not terrible, there's lots of time and place, but I think they're very overused, especially because white is a very harsh color. Especially on digital screens, white is a very aggressive and bright color. So I encourage you to not necessarily go straight to white as a background as a default, and instead explore some other options. Recently I've really liked this sort of ivory color. A light gray color can also be very nice. Or dark backgrounds are fun to experiment with. But if you do go with a dark background, just like I don't recommend a pure white background all the time, I would be careful unless you have a specific reason about choosing a pure black background.

Summary

So to review a little bit, I've talked about how you can establish a good layout in your data visualizations by creating clean lines and symmetry, reducing clutter, and increasing white space. Then you can use good fonts, not use system fonts, and establish a typographic hierarchy to help guide readers through your visualization. And then hopefully I have given you a little bit of the tools that you need to start coming up with your own palettes and choosing your own color palettes.

So with that, I will say thank you. And that's it. Thank you.

Q&A

Thank you so much, Will. I have questions from the audience. Tyler, you can come get that up a little if you want. The first one is, do you have any specific recommendations for aesthetics for maps?

Aesthetics for maps. I mean, essentially all the same rules apply, right? Maps, you want to try to reduce a lot of times the extraneous elements. So maps often have a lot of extraneous elements and borders and such. And sometimes you're going for a thematic map, you actually might want to emphasize those. But if you're trying to go for a very clean, easy to read map, you have to think about that. There's also a lot to be considered in maps with iconography. So using proper icons that help readers identify whatever you're looking for. Or using a really careful type hierarchy. So you have to really, really be careful about your type hierarchy and spend a lot of time designing that for a map since you have so many labels and so much type.

Next one is, shouldn't a binding constraint for color be colorblind friendliness? Yes, absolutely it should. I didn't have time to talk about this. The slides got cut for time. But another very important thing to do in color is accessibility. So you should always be checking your color palettes for colorblindness and also for contrast. And there's easy websites where you can do that.

Why is it better for a title to be left aligned instead of centered? The reason is mainly because in Western countries, at least, humans read from the top left. So that's where your eye goes first on the page. There's several eye tracking studies that show that your eye goes first to the top left and then to the middle of the page. And so putting the title at the top left is basically reducing the amount of work that the reader has to do to get to the information.

How long should one typically spend on creating slash designing a chart? How long does it typically take you to create one? To create a simple design? Like something I would do for fidelity? You know, something that just needs to look clean and readable? I would spend, I don't know, maybe a couple hours designing a chart. If I'm designing something more thematic or something for sort of a personal project, something more creative, I mean, it can take months. You know, it's not all months of sitting down just like designing nonstop for eight hours a day. But it's months of like laying in bed at 4 a.m. thinking about colors.

But it's months of like laying in bed at 4 a.m. thinking about colors.

Thoughts on Tufti-themed charts? I like it. That's all I'll say.

Oh, what tool has been used for creating the presentation slides? The presentation slides were created with Keynote. And let me emphasize, actually, I want to clarify. I like the Tufti R Markdown theme. I don't always agree with everything Tufti says. So Tufti, if you read like his DataVis books, he has a lot of opinions. I don't agree with all of those. But there's a Tufti R Markdown theme that's based on some of his writings, which I really like.

How do you deal with viewers using monitors that might render colors slightly differently? Yeah, that's a good question. There's very little you can do about that, to be honest. I don't have a magical solution to change everyone's monitors for you. All I can say is that we are lucky to live in 2020 when people have... Most people have more high-resolution monitors, so we can use things like fonts that have a lot of details in them and, you know, nice color palettes. But it's tricky.

Well, thank you so much. Another round of applause for Willow. All right. Thanks.