You may think of R as a tool for complex statistical analysis, but it's much more than that. From data visualization to efficient reporting, to improving your workflow, R can do it all. On this podcast, I talk with people about how they use R in unique and creative ways.
Hi. I'm David Keyes, and I run R for the Rest of Us. You may think of R as a tool for complex statistical analysis, but it's much more than that. From data visualization to efficient reporting to improving your workflow, R can do it all. On this podcast, I talk with people about how they use R in unique and creative ways.
David Keyes:I'm delighted to be joined today by Kara Thompson. Kara is a data visualization consultant with an academic background specializing in helping research teams and data driven organizations turn their data insights into clear and compelling visualizations. She lives in Edinburgh, Scotland with her husband and 2 daughters, and Cara regularly shares coding tips for data viz online and genuinely enjoys helping others level up their data viz skills through talks, bespoke organizational training, and 1 on 1 coaching. So, Cara, welcome, and thanks for joining.
Cara Thompson:Thanks for having me. It's great to be here.
David Keyes:Great. And I should also mention, Cara, you've you've done work with R for the Rest of Us in the past. I've been really excited to watch you, you know, build your own business, which has been great to to see as you've done that. A little sad for me because it's meant that I've had less of your skills available to do our for the rest of us stuff, but, I'm excited to chat with you. Well, I'm excited to talk with you about, all things color because one of the things that you've really gotten into is thinking about how to use color in plots.
David Keyes:So why don't I just dive into the first question? I think when people think about colors, you know, if they work for an organization, and they're thinking, okay. Oh, we wanna make Dataviz, the the natural kind of first step would be, great. Let's use our brand colors. So, you know, if you have, like, a blue and orange, great.
David Keyes:Throw them in. Make some plots. But I know that you've talked about why you can't just kind of take brand colors and and use them directly in DataViz. So can you talk about why that's the case?
Cara Thompson:Yeah. Sure. I think brand colors are always a good place to start if you're looking to create visualizations for your organization. But there are a few a few things to look out for. One is that they haven't always been designed with accessibility in mind.
Cara Thompson:You know, I remember a project that we worked on together, David, where there was, I think there was an orange and a blue, that when you put them through a colourblind test, they actually looked very similar to each other if they were done just in grayscale, for example. And so you want to be a little bit careful about just taking your brand colors because it might mean that the plots actually don't work for quite a a large group of people. The other reason why you might not want to just use your brand colors is you might need more than the brand colors that you've got. So, say, you're working for Easyjet and they want you to do some, visualizations of their data, if everything is orange that can be a bit overwhelming and and you might need some more colors than that. So, yes, one of the the challenges that I really enjoy is taking a brand colour and figuring out how we can build that into, a palette, of the number of colours that we need that work within the accessibility guidelines, and that also help us convey the the story that we want to convey.
David Keyes:So in cases where, you know, you say you don't have brand colors or or even, I guess, maybe when you do, how do you get inspiration to come up with color palettes that are gonna work well for Dataviz? Yeah.
Cara Thompson:Good question. I mean, there's lots of different things that you can do. In terms of general inspiration, I like hanging out in art galleries. Just there's something really inspiring about seeing seeing how artists have gone about combining colours, people whose specialism it is to, you know, to create beautiful visual things or visual things that are really, striking. So that's a general source of inspiration that I would recommend to anyone.
Cara Thompson:I find kids' books. You know, I read a lot of books to my daughters, and I guess because of the way that illustrations are done in children's books, the color colors are often quite vivid and that's quite a fun source of inspiration, as well. But if you're talking specifically about a project that you're working on, often there are colors that you can go to that will be tied to the project. So, for example, I've done this a few times when I've, created a story about the penguins. So the the palm of penguins is a dataset that's used quite a lot in data science, to to demo a few things.
Cara Thompson:It's a really fun dataset to use because of the correlations that are that are inside it. And so I tend to invent little stories about the penguins, baking things. And I I I've done this thing a few times where I show a plot with default colors, and I ask people, you know, which penguins were baking with ripe bananas, which ones are baking with overripe bananas, and which ones are baking with underripe bananas. And if you color it, you know, green and yellow and brown, then it's obvious which ones which. Now that's a bit of a literal, understanding of how colours can can map onto things.
Cara Thompson:But sometimes starting with thinking about the concept that you're talking about and what colors are associated with that, can be can be a great way to to start. Does that make enough sense, or should I elaborate?
David Keyes:Yeah. Yeah. No. Definitely. Definitely.
David Keyes:And that's great because I think, you know, for a lot of people when they start out, they're thinking, okay. You know, I have to come up with a color palette. Like, where where do you even start? They're, you know, infinite colors potentially. So Yeah.
David Keyes:How are you gonna decide what to use? I think, one other thing you've talked about is designing with accessibility in mind. I know you talked about that briefly, a few minutes ago, but you've also said that designing with accessibility first can actually have benefits for all audiences. So I'm curious, like, in the context of color, what does that mean, and how do you see that playing out?
Cara Thompson:Mhmm. Yeah. Good question. So in the context of color, there's a bunch of recommendations that come to make things accessible and they have positive consequences for everyone. One of the recommendations that I personally really resonate with, is that if you're just using primary colours, so a kind of really bold red and a really bold green and a really bold blue.
Cara Thompson:You know, the ones that you get if you just type red, you know, CSS red. It's really overwhelming to look at because those colors are just they're just really in your face. And so one of the recommendations is to use slightly blended colors so that you don't end up with that really hard hitting color, which I think you would all come across a website that you open up and you think, gosh, this was designed when colors were a really big thing.
David Keyes:Right.
Cara Thompson:And it's just really difficult to read. Whereas if you go onto a website where things are a little bit more muted, it's easy. Now that's not to say that it needs to all look like a 19 seventies film, where everything is just that slightly, you know, grayish color. No. You can have really fun colors within that.
Cara Thompson:But if you try and kind of blend in a common color, then that tends to do the trick, which you know, I created an, package to do that called monochroma, which we can talk about as well if that's of interest.
David Keyes:Well, before we get into that, I'm curious where your interest in colors in general comes from because your PhD is in psychology. Right?
Cara Thompson:Yeah.
David Keyes:And, I mean, you don't have, like, an art PhD. So I I I'm just curious because I don't think it's super common for someone with your background to have a strong an interest in colors. So, yeah, can you talk a little bit about where that comes from?
Cara Thompson:Yeah. Good question. I mean, I think I've always been interested in how the brain processes stuff. So I grew up in an English speaking family in France. So there were 2 languages going on, and everybody plays a musical instrument.
Cara Thompson:A while, we were all making sense of this. It you know, when you think about it and you reduce it, it's just noise. But at the moment, you and I are just exchanging sound waves, and yet it's communicating stuff from inside my head to inside your head. And I've just always found that fascinating. It maybe comes from that thing of growing up with 2 languages that you have an appreciation of the fact that the world sounds and looks and feels different to different people.
Cara Thompson:And I remember very early on asking, you know, how come if we're talking about the color orange, do I know that you're seeing the same thing when I'm saying that? You know? So I think it's more just a general interest in how other people perceive the world, and how we can make sure that communication is optimized, across different contexts, across different, you know, perceptual idiosyncrasies. Yeah. It's just something that's always interested me.
Cara Thompson:And then the effect that if you're going through a tunnel and there's funny lighting in it, you still know what color things are, because you kind of do some kind of interpretation on that. So, yeah, it's just I think part of it is just curiosity. Part of it is wanting to make life as easy as we can for as many viewers of our visualizations as we can. And part of it is that, frankly, I just think it looks better when when you take this into consideration. You know, I didn't you know, we talked about the neutercolors and that, you know, all the blended colors.
Cara Thompson:The other way in which it helps everybody is if, you bring your paper to somebody and they print it off in black and white, then they've got to still be able to read the plot. Or if you're presenting at a conference and the this, you know, the projector isn't great quality and that kind of messes up your visualizations. If you've optimized it so that people who sometimes struggle with color can see it as best they can, then it kind of helps you with all those different contexts as well.
David Keyes:Yeah. That makes sense. I know you've also talked about using color, as a way to be kind of less dependent on annotations in data visualization. Can you give an example of of how that might be the case?
Cara Thompson:Yeah. Sure. So I think there's there's 2 ways in which it can be the case. 1 is that it helps you remember what's what, and the other is that it helps you process a plot more quickly so you don't actually have to read the annotations as much. So that's a way in which I think they can make a a bit less dependent on annotations, in that they make the legend not redundant, but they make it easier to remember what's what.
Cara Thompson:Yeah.
David Keyes:Yeah. That's interesting.
Cara Thompson:It should
David Keyes:ask Well, one other
Cara Thompson:I wouldn't recommend doing a rainbow bar graph all the time. So the rainbow bars are just there to demonstrate stuff. Someone pulled me up on this online. Yeah. It's true.
Cara Thompson:If you create your bar graphs and every bar is different, then that's maybe not the best use of color, but this is just to illustrate that if you then had a, you know, a scatterplot somewhere else or, you know, some trend lines, if you've identified a clear color that's related to the concept that you're interested in, it's it's so much easier to remember what's what.
David Keyes:Well, and that sort of gets at I know you've talked, you know, in various places about the idea of color semantics. It seems like that's sort of getting at that. Right? Like, the idea that you choose a color not just because you think it looks nice, but because it actually kind of represents something, like red for raspberry or whatever.
Cara Thompson:Yeah. Yeah. Exactly. And then whether that's literal or more metaphorical. I guess the thing to be aware of in that is just making sure that, you're not bringing too many cultural assumptions into what other people associate with that color.
Cara Thompson:And again, being mindful of the main audience for your visualization, because that might influence the colors that you're gonna be using there.
David Keyes:Interesting. Have you had examples where you've chosen colors or or maybe seen other places where people have chosen colors that are, you know, work well in one particular cultural context, but don't translate as well to other contexts?
Cara Thompson:It's not something that I've really done myself, but I was just, you know, talking about this in a seminar recently, and someone brought up that point, and also talked about, you know, they were creating graphs about, climate change issues and looking at intercultural interpretations of the concept of Mother Earth and that the colours that were associated with Mother Earth were quite different in different cultures And, the need to be mindful of that if you're creating graphs that have got those strong, strong messages within them. And yeah. The I mean, the other place where I've seen that this can backfire comes back to your question about why not just use your brand colors. That if you're, say, telling a story about different demographic groups and your logo is Mr. Green, the groups that you make green, you're kind of saying is the main group in what you're talking about.
Cara Thompson:And so, it's worth being mindful of that as well. If you have one main brand colour, which group do you associate it with? Or do you associate it with a group or do you just try and stay away from it, and instead blend it in a little bit to the other colors that you're using?
David Keyes:Yeah. It's interesting. I mean, there's so much, you know, just talking to you, and you and I have talked in the past about color. But even now, I'm realizing, like, how much thought is involved in kind of developing palettes and, yeah, how how how far it goes beyond just, you know, use your brand colors. Mhmm.
David Keyes:I know that one thing you've done because you work with organizations to help develop kind of, like, DataViz design systems. That's what you call it. Right?
Cara Thompson:Mhmm. Yep.
David Keyes:So one thing that I know you do both, I assume, in in developing your own database design systems for organizations as well as, you know, showing other people how to do this on their own is you've developed a package called monochromer, which helps with the development of palettes. So, can you talk a little bit about the package and what the the idea behind it is?
Cara Thompson:Yeah. The package mostly grew out of me wanting a shortcut. So I was creating visualizations as part of tidy Tuesday, which is, an online challenge where somebody releases a dataset in which you can't, you know, you can't really put your foot in it. It's a dataset about stuff that's, you know, innocent. It'll be coffee ratings in a coffee competition, or it'll be, you know, pets that have been found at various places and locations.
Cara Thompson:So it's easy to make graphs and to practice because nobody's gonna be making a life decision based on these graphs. But anyway, I was I was thinking about in the challenge, somebody mentioned using monochrome color palettes. I was going on to, you know, HTML colour websites and looking at the gradients and picking them and copying them across. So it'd be so much better if I could just do this all within R. I bet there's a package for that, and there wasn't.
Cara Thompson:So I thought, okay, well, I'll I'll write it then, and see where we go from that.' So the idea behind monochroma is that you take a starting colour and you go darker from there or you go lighter from there and it gives you a range of colours and you can specify how many colours you need. That was really the starting point for it. And then from there I ended up using it in creating colour palettes for clients to blend in a bit of the client's colour, and also to teach people about, you know, if you're not starting from a photo and you're starting instead from colors that are in your mind, that you think are good for the the concepts that you're talking about, then blending in a little bit of the extra color can help it all work nicely together.
David Keyes:When I will admit, I haven't actually used oh, no. That's not true. I have used it once. But my understanding, based, again, on limited use, is it can also help you to avoid you know, instead of using, like, the HTML red, which will burn your eyeballs because it's so bright, it allows you to kind of, you know, blend in colors to make them more appropriate for for databases. Is is that an am am I remembering accurately that that Yeah.
Cara Thompson:Yeah. Yeah. Package that we have? Absolutely. Yeah.
Cara Thompson:I mean, the when I first created it, it was literally just, I I want gradients of this color. Colour. But the more and more the more we use it, the more I use it for exactly that purpose of of blending colours to make them look nicer, make them on brand. And also I use it quite a lot to change the text colour around the plot as well. So I have a dark text colour and a light text colour that are based typically on one of the colors that's inside the plot.
Cara Thompson:And that all comes from using monochrome as well.
David Keyes:Cool. So why don't you just show us how the monochrome or package works?
Cara Thompson:Sure. Yeah. Happy to.
David Keyes:Hey. David here. Just Just wanted to let you know that at this point in the conversation, we switched to a screencast. Now, obviously, showing code doesn't work very well in an audio podcast. So if you wanna see the rest of this conversation, check out the video version of this podcast on YouTube.
David Keyes:You can find a link to that in the show notes. I I know you've actually made a package for a client, the package is called Ophelia, where you, implemented their brand colors. So can you show kind of what it looks like once you've implemented it into a package, how how you then apply it to a plot?
Cara Thompson:Yeah. Sure. Yeah. I gave a talk about that. I think it was at our medicine last year, and it was just really fun being able to show people the the before and after and the process of of working through that.
Cara Thompson:We can maybe pop a link, somewhere to that if you want
David Keyes:to look into the details. We'll definitely put a link to that talk you gave, because I know you go into it in in even more depth. And it's just interesting to see, you know, like we've been talking, it's the combination of first coming up with a pallet and then thinking about how to implement it in code. And I think that's, you know, kind of your your special sauce is that you're gonna do both of those things, which is pretty cool. So one common response that I think, especially among kind of, like, hardcore data people, not all, but some, will be it's not worth it to spend this much time thinking about, you know, the aesthetics of your of your plots.
David Keyes:Like, colors aren't gonna really make an impact. So I'm curious when you hear that type of, critique, what what's your response? How do you how do you respond to that?
Cara Thompson:Yeah. I think that kind of critique is is difficult to challenge, because in some senses, you know, if all you want is something functional, then you might think that the colors don't matter. But actually, the colours are so much more than just making it pretty. You know, we talked about accessibility a lot of the time. The default colours that people pick are not necessarily easy to see for everyone in the teams.
Cara Thompson:You know, one of my friends works in a team and is very conscious that the default colours that come out in the stuff is not accessible to his colleague who's colourblind, and so it's just really interesting that what is perfectly fine and functional for somebody might not be for someone else, so there's an empathy side to it. But actually the colours do make it more functional. They help you remember what's what, they help you when you're creating your visualisation, to not have to spend too much time, you know, if you're checking, 'Is that data point in the right place? Wait a minute. Which group does that belong to?' you know, I was doing that earlier, and I was jumping between the dataset and the plot, and the dataset and the plot was like, no.
Cara Thompson:Let let me just put some sensible colors in here, and then I'll be able to see what's going on, and that'll make it easier for me in creating it. So I think while it feels like an unnecessary investment of time to come up with these things, it actually ends up saving you quite a lot of time in the long run because it saves you time checking stuff, it saves you time interpreting stuff, it saves your readers time interpreting it as well. So, yeah, it's not just about making it pretty. It is about making it a lot more functional than than it currently is.
David Keyes:Yeah. That's great. Yeah. And I think that idea that, you know, maybe you spend more time upfront coming up with, you know, thinking about what what's an effective color palette for your organization. Obviously, that's gonna be more time than just, you know, slapping on scale fill, whatever.
David Keyes:But in the long run I mean, in some ways, it's, like, similar to learning r, you know, because I always tell people when you're learning r, it's gonna you're gonna be a lot slower initially in r than with Excel or whatever other tool. But the more you do it, the more efficient you'll become. And it seems like it's a very similar situation with developing a color palette. Yes. It might take a little longer to come up with something effective, but in the end, it'll save you time and, of course, be, you know, colorblind friendly, be better at communicating and all that.
Cara Thompson:Yeah. Absolutely.
David Keyes:Great. Well, last question. So you I think we've established, care a lot about, the aesthetics of colors, you know, thinking deeply about colors. But if someone is not, you know, as invested in that process or, you know, wants to use better colors but doesn't go to art galleries and think about how they can apply those colors to their plots, I'm curious if you can give, you know, maybe 2 or 3 tips to help them think about how to use color more effectively in their data viz.
Cara Thompson:Yeah. Sure. And so I guess if you're really not interested in in what it looks like, but you just wanna make it functional, then pick a color that starts with the same letter as the level that you so female, like, we did, you know, we made the gen 2 penguins green, and then it was really obvious that something had switched in the plot when we were looking at it the second time around. So, yeah, that's a very functional way to do it. I would say consistency is really important as well.
Cara Thompson:So again, even if you're not too fussed about the the aesthetics of it, making sure that you've always paired the same color with the same concept throughout your report means that people can easily, jump to the thing that they're interested in looking at, and not have to relearn with every plot. Okay. Purple is this, but last time it was orange, and then it's gonna be pink next time around, and, oh, it just gets quite confusing. So, be inconsistent. But, also, I would encourage you to think about the things that you enjoy visually and what makes you look longer at, I don't know, a photo, or a picture or a report or a table or a visualization then looking at another one, it's probably because there's something about the composition of that that you're enjoying.
Cara Thompson:And so you ultimately want people to be looking at the stuff that you're producing. You want people to be remembering it. So it's worth thinking about what might help them do that. And I think choosing good colors and good fonts is an important part of that.
David Keyes:Great. Well, Cara, thanks so much for joining us. It was really interesting. I mean, it's for me, as someone who does think about color, but nowhere near as deeply as you do, I definitely learned a lot. So so thanks again for joining us.
Cara Thompson:Thanks for having me.
David Keyes:That's it for today's episode. I hope you learned something new about how you can use r. Do you know anyone else who might be interested in this episode? Please share it with them. If you're interested in learning R, check out R for the Rest of Us.
David Keyes:We've got courses to help you no matter whether you're just starting out with r or you've got years of experience. Do you work for an organization that needs help communicating effectively with data? Check out our consulting services at r for the rest of us.com/consulting. We work with clients to make high quality data visualization, beautiful reports made entirely with r, interactive maps, and much, much more. And before we go, one last request.
David Keyes:Do you know anyone who's using R in a unique and creative way? We're always looking for new guests for the R For the Rest of Us podcast. If you know someone who would be a good guest, please email me at david@rfortherestofus.com. Thanks for listening, and we'll see you next time.