R for the Rest of Us Podcast Episode 21: Cédric Vidonne
In this episode, I talk with Cédric Vidonne, an Information Management Officer at the United Nations High Commissioner for Refugees (UNHCR) with over 15 years of experience in humanitarian data visualization. Cédric shares his journey from GIS and cartography to creating impactful infographics and embracing the R programming language. He discusses how R has revolutionized data efficiency within UNHCR, where it aids in producing faster, reproducible data products essential for crisis response. Cedric also highlights the growth of the UNHCR R community and introduces the organization's data visualization guidelines platform, which includes a custom ggplot theme that streamlines UNHCR branding. Additionally, Cédric explores the advantages of Quarto for developing UNHCR-branded templates, enabling team members to create consistent, polished reports with ease.
Listen to the Audio Version
Watch the Video Version
You can also watch the conversation on YouTube.
Important resources mentioned:
UNHCR branded theme for ggplot2 and data visualization color palettes
Connect with Cédric on:
X: @cvidonne
Mastodon: @[email protected]
LinkedIn: Cédric Vidonne
Learn More
If you want to receive emails to help you on your R Journey, sign up for the R for the Rest of Us newsletter.
If you're ready to learn R, check out our courses.
Transcript
[00:00:00] David Keyes: I'm delighted to be joined today by Cedric Vidonne Cedric Vidonne is an Information Management Officer at UNHCR, the UN High Commissioner for Refugees, and Cedric specializes specializes in data visualization.
With over 15 years of experience in the humanitarian sector, Cedric has developed a wide range of data driven products, from infographics to reports and maps, while also contributing to data visualization guidelines, templates, and standards. Beginning his journey in 2008, And recently, Cedric embraced R, transitioning from a design centric approach and has developed a few R packages to support the growing UNHCR R community. Cedric, welcome and thanks for joining me.
[00:01:14] Cédric Vidonne: Thank you. I'm really happy to be here. Super excited. Kind of stressed at the same time when I've seen the people you've interviewed in the past, but really happy to be there. Happy to share my experience
[00:01:25] David Keyes: Great. Well, I am excited for people to learn more about you and the really interesting work that you do. Because I spoke with Amadou Diko on a previous podcast episode, who I know you work with. We were talking some about the kind of design work that you have done and how that's fit in with, the work, um, at UNHCR. But before we get to that, I'd love to know, you know, I talked a bit about your background, but if you can kind of give me like the, the cliff notes, uh, short version of your background and how you've ended up, um, you know, working at UNHCR doing the type of work that you do today.
[00:02:08] Cédric Vidonne: So yeah, so as we mentioned, I'm currently an information management officer specializing in data visualization at UNHCR. I'm based here in Geneva, Switzerland, which is the HQ of UNHCR, so that's the main central point. I've been doing the humanitarian work for over than 15 years. I started in 2008, uh, back in New York, actually, with another UN agency, uh, and I started, um, as a Newton.
Uh, it was an internship, uh, during my master's degree in GIS. So I have a background in geography and GIS. And I started as an intern within the UN system making maps. I was a cartographer at the time. Uh, so I started making maps for the UN and it went really well. And my actual boss over there, uh, she was, uh, Really interested in design, infographics, and data visualization, so that's all I kind of like transitioned to not only making maps, but making information products that were including maps, charts, some narrative, a real context about the situation and everything.
So that's all kind of like slide from only making maps to making more complex and I would say design-centered um, information products So that's it. That's kind of like this slow slide I, I, I did to data visualization and it became my bread and butter. I really, I got really hooked up into it, onto it. So I just, you know, started to do everything I was making, always add some maps component, but that more and more design charts, plots, and everything.
Um, as you mentioned, that was always kind of like a more static approach. Uh, meaning. You know, the typical way of going into a GIS software, making a map, exporting it in Illustrator, polishing it, then doing a chart there, blah blah. A lot of manual work, but that has been the way of doing infographic within the UN for quite a long time, and I think it's still the case.
So probably it's what we'll discuss a bit later, but that's, that's the, the, the actual status in the, in the humanitarian world. And then I started working for another agency, UNHCR, uh, when I started back in 2010. I think not 2013. It was really, there were, there were no people doing visualization at UNHR.
So it was really the beginning there. There was, that was, there was no pure real brand at the time neither. So that was really something kind of new information products were always there, but more in the format of a PowerPoint or data or information like this. But, uh, yeah, so I started and we build them more guidelines, templates and tools and all the things we're going to discuss today.
And, uh, yeah, that's. Basically, I started and I got hooked up into data
[00:04:54] David Keyes: So I'm curious, like, can you give me, I don't know, a couple examples, um, of, say, when you first started working at the UN as an intern, what, what were the types of maps that you were making? What, what does the UN want to see?
[00:05:08] Cédric Vidonne: Uh, basically it was, uh, I would say when there was an earthquake happening somewhere, you would just map where the earthquake happened, what was the most affected areas and this kind of things. Or when you have forced displacement of people, where do they move first? What border crossing point did they take?
And this kind of thing. The idea was to be always super. Uh, I would say quick. And so basically when it happened after a day or two afterwards, we had a map and everything that we could show on it and stuff like this, it was not super detailed and everything, but at least the information was there and you could see it visually and geographically where it was happening in the world and all, you know, all we could react and maybe, you know, what was the best way forward
[00:05:51] David Keyes: that.
makes a lot of sense. And so at that time you said, you know, you were using, um, you were, you were not working in R, um, at that point.
So I'm curious, kind of, how, how R fits into this? How, when did you get into R? What led you to do that? And what, what has that changed in terms of the work that you do?
[00:06:12] Cédric Vidonne: I think I got into R fairly recently. I think my first interaction with R was probably in 2020, uh, not before that. So yeah, it's, it's kind of, uh, kind of new for me. And, um, It's actually colleagues. So within UNHCR, you mentioned Amadou, that has been part of the podcast before that I'm working constantly with.
And there was other people like Edouard Le Goupil, that was also kind of a pioneer in the UNHCR community. And I think we started like a super team. Small team that were actually doing R, not actually even team. It was more like people scattered around the globe, starting to do, you know, trying to find ways to do, to be a bit more efficient, a bit less manual, try to do, you know, more work that has, that can be a bit automatized and not just on the copying, pasting.
And, uh, and, uh, I think that's basically where I started. They kind of like dragged me into that. And maybe the other component that kind of like sold me the, the, the R thing was all the. Incredible viz, like you could find in Tidy Tuesday or these kinds of challenges where you see people making incredible visuals straight out of R and also people that you had in this podcast before.
So yeah, it's like, wow, you, you can actually make that just with code. And for me, it was kind of like a game changer. I think I started fairly slowly by just using. It's for ggplot, I was not even cleaning and wrangling my data in R, I was still doing it in Excel and just, you know, plugging my data, doing my plot and, oh, okay, I can make that, that sign and I can replicate it easily and stuff like this.
And strangely enough, I think I started, maybe after two months I was actually playing with R, I started building a package. As a request of my colleagues like, because it was, the package itself was not really about R. It was more about CSS, HTML, and this kind of thing. So it was for a report template.
So it was more this kind of thing. So it was in page, page down. So basically. Most of it is, is, is CSS, so it's not really R, so that's a bit, oh, I got dragged into that. And, uh, and I think, yeah, it took me quite some time to start doing data wrangling and everything in R, but, uh, yeah, I think now I'm, I'm definitely using it daily, probably not to make all, only viz and stuff like this, but, uh, just to wrangle my data instead of opening it in Excel, I will start doing it here, analyzing it quickly, making quickly a plot if I need, or this kind of thing.
And it changes a lot of things. And from what we probably see in the future in this discussion, I think it's also the repetition of the task. I mean, often we have to do the same product over and over, or we have to update it, the data changes, and we are in a really, I would say, fluid, world where emergencies happen every day.
And, uh, you know, you get data in the morning and the data in the afternoon would be different. So if you do everything manually, basically you start over the process again and again. So that's for me, probably the game changer. And. I don't think we are there yet, but I think it's what we are trying to build now.
And also it's fairly new R for our community, even in of data, data people that have been working in Excel or in databases for years. They're not all familiar with R, but it's growing. It's growing. Uh, I think when I first, Started to, to build this package. We were, you know, uh, I don't know, maybe, uh, a couple of dozens of, of playing with R in, in, in UNHCR.
And now we have kind of a community where we have a chat, we are sharing experience, tips and tricks, and it's more than 150 people now. So, you know, it's, it's growing and it's, uh, I think people are getting interested and, and yeah, there, there are definitely ways of doing our job. I think. more efficiently and in a more, uh, in a reproducible way.
And also I would say we are more accountable. We can show how we did it. We can, you know, people can replicate it and can access the data, can do their own analysis and just, you know, see that with open eyes and not something that is hidden somewhere in the Excel sheets of a person and in a new stratified.
So I think that's. where we are heading. Not sure we are there yet, but that's, I think that's what we are trying
to
[00:10:36] David Keyes: achieve I'm amazed I didn't realize there were 150 people using R at UNHCR. That's a, it's a quite a sizable number. I'm curious, can you give me some examples of what are the kind of jobs that those folks have and what are they typically doing with R?
[00:10:55] Cédric Vidonne: I, I think this is also due to the fact that we have more and more statisticians within the organization, uh, to, you know, Amadou is one of them, uh, and we kind of like, uh, went through a process of regionalization a few years back. So people that were based at HQ are now sitting in a different region around the world.
So it kind of like, uh, increased the number of people that are. that have this kind of like, uh, statistic background. I think we're also now starting to do more and more data science work with modeling and all of these things that before we were not really doing. Data has be became really central to UNHCR a few years back, uh, UNHCR is trying to, to be the reference when we, in terms of data, when we talk about displacements and forced displacement and people moving around countries and crossing borders.
And so I think The importance of data in senior management and even really high in the organization really changed a few years back. And the importance, all the data that we actually collect and, and have every day, it's, it's, it's a lot. And now we are doing something with it. And I think this created definitely profiles that we didn't really have before that are now part of the organization.
And. it's Also, why their interest for R really increased, and people are using it more and more. Or people like me, that were doing visualization work, and dealing with Excel to make my data viz and stuff, and I'm just, you know, doing it all in R, and I don't have to switch back and forth, and if the data changes tonight, I can just rerun the thing and I have it.
So
that's, uh,
[00:12:32] David Keyes: an example just to make it really concrete, like an example of a project that you have worked on or seen someone work on recently using R at UNHCR. Hmm.
[00:12:44] Cédric Vidonne: uh, well using R, I think, um, I, uh, I don't have a project or at least that I know of that I'm using R from the beginning to the end, because I think we also have this variety of profiles, some people that are doing. Also data related jobs that have no experience in R, and we are still in this world where Excel is definitely the king.
Uh, we have Excel, we have GIS software that have been around for years, and we also have now Power BI. People are really fond of Power BI and the dashboard and everything. So this, and it's also the tools that the organization provides. Uh, r is something a bit different. You have to be interested. You have to download it and use it.
But, uh, I think if I, if I, um, if I will be dreaming, I think if we could make, uh, what we do, uh, a lot in, in, uh, in the humanitarian sector for emergencies, we are making a lot of. One pager pdf that is basically kind of like a summary of the situation. So basically you have a couple of key figures that let's say, or you have a 2.1 million people displaced and blah, blah, blah. And this kind of thing. And then you have a couple of graphs that will show probably the evolution of this displacement or the type of people or the type of needs that they might have. And then you have a map with something or where, where are those people?
What do they need? Where do we need shelter for them? And all of these things, they are kind of like summarized in a nice and beautiful way on a piece of paper. And I would love to be able to just do all of it in R, basically from the collection of the data, from cleaning it, from making my visuals and stuff, that would be, that would be the case.
But in a day to day, I would say, um, we're doing a lot of, uh, data stories with my team. So we, we are very small team that, that basically, we are more a support team. So we offer support to others within UNHCR. Uh, either for just making simple chart or making reports or making, you know, more important, uh, um, stories.
And we do more advanced data stories that I maybe have time to show afterwards, but there are a lot of, it's an actual story like you can see in the pudding or, you know, this kind of media where you have a narrative, you have pictures, you have visuals and stuff. And basically, um, Make all the visuals and the data wrangling that is tied to those visuals in R.
And then even on the main UNHCR. org website, we have a few, um, visuals that have been, or maps that have been actually created. From zero to two, from A to Z in R, all of it from the, as a production, uh, visual. And, um, other things I've seen, if you could have seen it, maybe with Amadou, it's all those, those presentation of statistics.
So they do, they call the data directly from API in R and make this presentation and that they can then present to senior management or to donors, the statistics that are up to date, branded. straight out of R because we have made some packages like this. And we also have like a lot of reporting templates.
And so this, I'm not really in the report business in terms of a day to day job, but I think that's why I built those packages because people could just, without thinking, you know, with, uh, with just adding a template to their, to their, to their project, having a beautiful UNHCR branded product that they don't have to think about, just to think about the content and don't care about the look
[00:16:15] David Keyes: and
feel Yeah. That makes sense. and yeah, I'm looking forward to chatting in a few minutes with you about both a package you have made for, um, that has a ggplot theme for UNHCR and then also a quarto
template that you've made to kind of help people who want to, you know, take those plots that they make as well as text and whatever else, maps, maybe. And add them to, um, a nice template. So before we dive into that, I, I guess I'm just curious, why, why is UNHCR so, invest so much in data visualization and kind of, um, you know, making things look good, I, it seems, I mean, tell me if you think this is wrong, but it seems unique in that there are a lot of organizations that don't invest quite as much. effort and capital into this. So do you, do you think it's accurate that UNHCR really cares about that type of thing? And if so, why?
[00:17:07] Cédric Vidonne: Uh, I'm not sure it's unique in the humanitarian sector. Uh, uh, I think, um, another agency, UN OCHA United Nations Office for the Coordination of Humanitarian Affairs was probably the kind of like a pioneer in this approach of having really polished visual products that are easily understandable and that you can share with a wide variety of stakeholders being donors, uh, being non data people, but that I can, uh, senior management, but they can still get a sense of the situation.
And I think that's Something where they saw the importance of their brand early on in the process. UNHCR has built a really strong brand. I think we started in 2015, like building a really strong and bold brand that is recognizable and that people can identify to. And I think that brand followed by the data and the importance of the data for UNHCR made it that we needed Nice, beautiful, polished, and with a really strong standard data visualization.
So I think that's where a bit of it
build out and why we're here now. And, um, I, yeah, probably UNHCR is good, well placed in, in this, uh, in, in, in this organizing all of this standards and everything. Uh, but I think we are not the only one. Yeah, there are, at least in the humanitarian sector, and I think it's also due to the business itself, or not the business, but I would say that like the the composition of the organization.
So I think we are 18, 000 people working for UNHCR scattered all across the globe. in some really remote areas, difficult, you know, where you barely have internet. So basically we need really strong, if you want to feel as one, you definitely need strong standard and brand and guidelines that you can follow and that are easy to use also, because being that big and that scattered around the world, it's, you definitely have a wide variety of profile and technical skills and everything.
So it's, it has to be, you know, user centered more than,
more than anything else.
[00:19:21] David Keyes: So one way that you've kind of implemented, you know, enabling people to use the UNHCR branding is through making a package called UNHCR themes. We'll post a link in the in the show notes so people can check it out. Before we have you actually show the code and show how the package works, I'm curious what led you to develop it in the first place.
[00:19:49] Cédric Vidonne: Well, I think the first, uh, well, uh, the first was the ask from Amadou and others. So basically if I could, I could make it. Uh, I think at the time, uh, we developed the first iteration, the, the, the R users within the organization were not that high, but, uh, Yeah, I think in 2018 it's, or no, 20 or anyway, a few years back, we developed a data viz guideline that was the first of its kind for UNHCR that was kind of like following the brand.
And this data viz guideline was, the idea of this data viz guideline was to be technologically agnostic, meaning that you could apply those, those, uh, recommendation. Through different, uh, system being Excel, being Illustrator, being whatever you were using, you could just apply. Overall recommendation. So based on that, it was super easy to just say, ah, let's make a ggplot theme that just, you know, embraces those recommendations.
So people can simply by adding a couple of lines in their code, uh, starting from a default ggplot, uh, chart to something that is UNHCR branded that people can recognize with the colors, with the fonts, to the organization of the headers of the title, subtitle and everything. So I think that was it.
Basically the idea, just again, try to cover as much possible ground we could with those standards, so it makes any user able to make UNHCR branded charts. Again, with this data viz guideline, we created tons of templates and tools, even in PowerPoint, even in Excel. I mean, everything we could. I have a colleague that is really strong in D3 and Python, so we also have Python templates and the D3 templates to make visualizations that are UNHCR So, you know, it's basically it kind of a bit of luck, meaning like I, I had the R willing, I mean, I had the willingness to learn R and we had, I had the design background. So we're like, Oh, let's, let's try this. And it was a good introduction to R for me. And, uh, I really like it. And. Yeah, I'm a bit of a kind of a, I don't know if I can say that, but I'm a bit of a freak of
consistency
and standards so Yeah. Yeah.
and stuff.
And so it was, uh, you know, just expanding that a bit. So yeah, that's, that's how it started. And, and just again, I think everything we do in terms of guideline and templates and tools, just trying to. support colleagues out there. And so it makes their, just make their life easier. So basically if it's just adding a line to their R code to get a nicely polished UNHCR plot, I think we, you know, we can just spend a couple of days or, or, or, or weeks trying to build a package that will fit their, their needs.
And, and this package with the community really. It's matured and it's now on CRAN and everything. So it became something really, you know, it became something that is now really within the organization. People know that package are using it and making plots with it. So, yeah, I think it really is supporting the
[00:22:54] David Keyes: what would be interesting at this point is to have you put your screen up and show,
and maybe I was even thinking actually if you want to first start by showing the data viz guidelines website, because I didn't realize how much that spurred the creation of the theme. Um, so maybe show that first, so you have up now, um, the website, the data visualization platform. Uh, I wonder if you could just like kind of briefly walk us through this
[00:23:21] Cédric Vidonne: okay. So yeah. So the website was not, the first thing we did, it was, we started with the guideline that is kind of like more traditional PDF, uh, that was just about. charts and layout and stuff like this, but based on the success of the guideline, we're like, ah, why not expand a little bit more?
And, you know, kind of like have a platform here where people can come and, and get everything they need about data visualization for unit charts. So basically, We have a little part about that work we call chart gallery. It's where you can find all the information about chart types. What chart types to use in what context, what is the best use, what are the bad practices, what are the things to avoid.
Uh, a bit in the vein of like the R, uh, what it was like the, um R graph gallery? Yeah, the R graph gallery, exactly. Yeah, yeah, yeah. So, uh, actually we kind of like kind of used a bit of this idea of having, you know, by chart type and stuff. So that, that's what we did. We definitely have the guideline itself where you can see, you know, at a glance, just, uh, what are the glide and then all the tools, uh, being in office, being an illustrator, being in R, D3, Power BI, even GIS and everything is there.
And then we have a little showcase place where we show our biggest products, the more like data story, like products. So that's a bit of how we organize the, the website. And, and so basically, as I said, if you go to the chart gallery, you see a different type of chart where you can go and you click on one and it will tell you what is the best use for this chart, the do's and don'ts and, and this kind of things, and then it will link to the different tool that we have available for every single, single type of those charts.
So, uh, That was a bit the idea. Uh, something I haven't mentioned yet is that part of our job is also some training. So we do a lot of trainings of colleagues. Uh, we do data visualization training when we, we teach them what are the best practices, when to use this type of chart, a bit what you can see on this platform, but as a face to face and try also to train them in the different software.
Simple ones like Microsoft Office, but also more advanced, Illustrator or this kind of thing. And more and more, like now we are doing some scripting and coding with R and different tools. Again, here just the guidance. So basically you can download the guideline, but what you asked before about the ggplot theme, the idea was basically to replicate that.
So how can I apply those styles, that my title is black and bold, that my subtitle is this side, that my legend should be placed here, et cetera, et cetera. All of this It's a little detail that you can just set into a ggplot theme. So that was the idea of the package. And the second aspect of the package was the color palette.
So I just have, you know, all the ggplot scale available, uh, directly in the package, not having to think of what is the color code or the blue number one of the palette at this kind of thing. So, uh, the colors are a bit. Strong, uh, that's our brand. So this, there was nothing we could really do about it.
But yeah, that's a bit the, the idea. And then we have all the different tools and, uh, you know, being, uh, as I mentioned, NSL Facebook or BI that are really popular within the organization because there are tools that are provided. Illustrator, uh, I think it's more our team, but it's also a lot of people are familiar with the illustrator, uh, something that.
that has been used in the humanitarian service sector for quite some time, and GIS, because yeah. Uh, we all love math, so that's, uh, something we had. And as I mentioned, we have now coding tools like R, Python, and D3. And we make this one a different approach. It's a bit more like tutorial type of things where basically you have the code on one side and then what the result that will give you.
So that was, uh, that was the idea of this platform. So it was difficult to make, you know, kind of like templates for, charts. Uh, I think we might get into that making, you know, Functions, like, uh, of, usual type of chart, maybe bar charts, column charts that could be easily, you know, as a function, not even have to create this own code for ggplot.
But, but that was a bit the idea of those, those, uh, thing. And yeah, the latest is, is our own, like trying to, you know, showcase ourselves. And this is this kind of like, this is ggplot. This is ggplot. You know, some of those charts are definitely ggplot that has been used, but not all of it. This is also a ggplot.
So that, yeah. Cool.
[00:27:56] David Keyes: So I can totally see, I mean, especially when you were showing the one chart with, that was annotated with, you know, the title should be this and that, like, I can absolutely see how that directly, Then applies to to making a theme.
So I wonder if you could now kind of show us the UNHCR theme and talk about the process of going from, this guidance on the screen to implementation of it as a ggplot theme.
[00:28:25] Cédric Vidonne: Yeah, sure. as you mentioned, the idea was to basically Replicate this approach, uh, as a team. , we just use a normal package for that. I think I just quickly prepared something here. I just have a simple plot so we can see. So basically that's what you will get. Uh, if you make just a simple plot with ggplot, uh, the idea of the, the UNHCR theme package was to try to, to keep it as simple as possible.
So basically we created a theme function, uh, a bit like you have for team grid, or team minimal, or none of this. We just created a theme UNHCR function that will basically apply all the layouts that was presented here to your, uh, to your chart. So if I just applied this one, it will basically change all my style that it was there and basically replicate what we had on the other chart here with moving my legend here to the top.
Uh, having my title now in bold and black and, you know, all of the things that have been just moving around and the source is now on the left side and all of this, that is basically part of our, of our team. Uh, as I mentioned, the second thing that was important for us was to be able to manage the color directly here, because here you can see, I just, stick with, uh, standard ggplot color.
So we created some, some scale for the team. So it would make it easier for a colleague to just apply them. We basically created a bit like the approach of, of different color packages for discrete color, for a continuous color, and, also for, for, uh, bin. Uh, but uh, that's basically a bit the approach we take.
So if I just with those two lines of code added to my GG plot from the beginning, I will then now get, uh, A-U-N-H-C-R branded just, uh, out of the box and. I mean, if you just do this, at least you are 90 percent close to a nice looking chart, at least branded with the UNHCR. There are definitely some work maybe in terms of spacing or arranging a bit of plot, but I mean, really close to final and plots that you could easily put in a presentation, to senior management just to show an evolution or something. Yeah. And I know,
[00:30:49] David Keyes: I mean, from having looked through the code before we chatted, you know, I know that you put a bunch of kind of defaults that work when you just apply theme UNHCR. I know one of the challenges when making a ggplot theme is thinking kind of like, how much do you set defaults for people, and how much do you leave it up to people to, you know, customize further using just the regular theme function from ggplot? So can you talk about how you have arguments within theme UNHCR, how that works, and what you decided to include there versus leaving up to individuals to customize themselves?
[00:31:28] Cédric Vidonne: So I think we We actually went kind of all in on this one, I would say, where we added a lot of default directly within the team UNHCR, uh, the idea behind was just to make it as simple as possible to the user. Uh, the good thing with any, uh, ggplot theme is that if you want to override it, you can always call a theme afterwards and overwrite, in the way you want it and make it and make it yours.
But we, we really. Included a lot of default within the team, but we kept them kind of like open. So basically you see that the team UNHCR has a lot of arguments. It's a function with a lot of arguments, but even if it's not recommended, because Lato is the font of choice for UNHCR, you could still go here and say, I don't want Lato anymore, but I want to use another font.
You can still go, especially if you work for a web browser. Plots. You probably want to change your front side to something bigger. You can actually impact a lot of elements of the team directly within the team function itself. Uh, so that's a flexibility that we wanted user to have.
I think in 90 percent of the cases, people won't have to change, uh, I would say to this, nothing should happen. But after that, it's where it becomes interesting and where you can start adding some access text. If you just want the Y axis or, you know, this kind of thing where you can play a bit with, I want to access title.
I don't want, can I play with the grid? I just want my grid on the X axis, not on the Y, this kind of thing, appearing the legend and stuff. So all of this could be. Change directly in the theme afterwards, but, uh, I think it's less simpler to just call Legend Fault Yeah. Here and have my legend peer within my team call instead of having to do another one, another plus team.
Yeah. Blah, blah, blah legend and all of this. So I think that was a, that was a kind of like the design decision trying. Make it as user friendly as possible. I mean,
[00:33:34] David Keyes: that makes sense because I will say the theme options, I can't tell you how much time I've spent on the ggplot documentation website, remembering what are, what are the, all the options you can do in the theme function.
So having, you know, the most common ones and being able to UNHCR function. It definitely makes a lot of sense to me. Um, so one other thing I saw was that within the package, you actually set it up so that when the package is loaded, it updates various geom defaults. In other words, for example, it sets the default font used within geom text.
Can you actually just briefly show that in the code of your package and then talk about why you designed it in that way?
[00:34:24] Cédric Vidonne: Yeah, sure. So basically when we do the onload of the package, we, we call the function that we call update geom.
And just to
[00:34:32] David Keyes: clarify, onload, I've never actually used it myself, but I guess what it does is whenever you run library UNHCR themes, that function also runs, correct?
[00:34:45] Cédric Vidonne: Exactly. So the idea was to, um, if you scroll down around really, so that's our, but at the bottom we have this. Yeah. Yeah. It's a really long one.
We have the, update GeomDefault function, which basically, uh, will update everything about, um, GeomText, GeomLabel, and ggrepel. Yeah. Yeah. So basically you have text repel and label repel, where it will actually call the Lato font. This is made because usually if you do a normal, uh, ggplot call and then you call here a geom text and you add some label to this call, it will actually go back to the default font of your computer being the, the sensory font or whatever it is, the default font of your computer.
So that was to avoid the fact that if somebody Make a plot and add labels to the plot that the labels are actually not using the UNHCR default font, but another font. So instead of having people calling that font at the beginning here, basically what you should do is you should call that for update your geom default here at the, at the beginning manually, instead of having us People have to do that or have to enter that.
The family, the phone family is a blah, blah, blah, directly here. It's call on load. So they don't have to think about it.
[00:36:13] David Keyes: Yeah. I mean, that's, that's super smart. Um, I know, um, I was looking at the urban.
[00:36:19] Cédric Vidonne: That's a non binding thing. Yeah, the Urban Institute has
[00:36:22] David Keyes: a ggplot theme where they do that, um, I think they do that as well.
Um, it's, it makes a ton of sense because I know it's really confusing for people, especially when they're starting out. They're like, wait, I have to set the font family in the theme, but then that's separate from every time I use gm text. So that makes a ton of sense to, you know, people. implement it that way.
[00:36:41] Cédric Vidonne: Yeah. And talking about text, another thing that we did, and I think that was a really nice one is we included ggtext as the default for title and subtitle. So basically If I have a really long, uh, subtitle or title, I can just run, uh, with the team UNHCR. We implemented ggtext as the main thing. So first of all, now you can stylize some of the text directly with the, with the HTML code. And the best of it is so you don't have to think about cutting where it does my line cut, blah, blah, blah.
And I have to insert the code and, and because I think this is a really tricky one always when you are like, Ah, where, and especially when you're. You know, you're playing in the plot panel here and then you save and it changes completely. So, and so with ggchecks, it's just automatic and people don't have to think about it.
So yeah, as anything we've made, I think everything was always made to make it People's lives
[00:37:45] David Keyes: as easier. Well, speaking of making people's lives easier, in addition to making this theme, you also have made, um, several quarto extensions. Um, the one that I thought might be interesting to talk about was the, um, reveal.
js. Uh, template. So this is a template for people who want to make slides using quarto and it applies UNHCR branding. And I know in our email correspondence before we were talking today, you said, well, this isn't actually R. This is like lot of HTML and CSS, but I think it's actually useful to show, because I think, obviously the content that you would put in a, template like this, um, or in a presentation would be made in R, um, but the, the process of customizing it and, you know, making it on brand is going to be done with other things.
So can you talk to me just a Before we even actually show it, um, if you can actually just talk about the process at a very high level of making a quarto extension and what that involves.
[00:38:51] Cédric Vidonne: to be honest, for me, it's been a game changer. Especially for SAS and CSS, quarto versus R Markdown in the development process, because basically the structure of your extension follows the same structure as your final, uh, extension or when the people will use it, basically it will create an underscore extension UNHCR folder on their project.
And so basically the good thing is that you can Work on the visual aspect straight with the same structure of your extension. You don't have to go, because I remember, for example, doing a lot of page down, um, page down report extension. You have to do all the SAS and CSS before with calling directly in your extension to see the result.
And then. You package that into a package. So it's, uh, it's an extra step. And I think this is really, uh, been a game changer at this for me in terms of, of creating those, those extension. And basically creation of extension, I think Posit made it really easy. You just have one line of code in the terminal and it creates the whole structure for you.
And then basically it's just a YAML, uh, a YAML file and then all the different Resources that you, you might need. And your YAML file is really, really easy where you can sell the different default from what format you're using as a base here being just rebuild. js. And then some themes that are recalled.
So we have our specific, uh, SCSS that it's the UNHR one and some logo that you can add, and, you know, some basic default, uh, information that you can put. And, and that's basically it. You have a new, new extension. And, and then, as you mentioned, it's, it's a lot of basically CSS. So you just, you know, call your, your brand color, you just change that and then, you know, just make it so it's a look and feel of your brand.
And, that's basically, basically it. I think there is Emil that is doing a lot of those kind of like extension for, for rebuild and, and a lot of CSS and. Yeah, that's, that's why I felt a bit like an imposter being here, talking about R, because I think it's a lot of You know, it's a lot of fun. That's what we
[00:41:01] David Keyes: do a lot of as well is combining R with other tools.
Can you also show, cause, um, I know there's the template. qmd file because that's where you actually kind of lay out the like default content that shows up when someone makes this. So if you could share that file, that would be helpful. So
[00:41:19] Cédric Vidonne: we, yeah, so we decided to go for being the template being kind of like, uh, guidance at the same time.
So, it's a revealed presentation. So, we just use this, and I can, I have the result here. We use this as, this is the template QMD you get, and it's actually explaining you what the quarto reveal is, how to use the, uh, uh, The extension and, how do you create basic slides, just the, the simple explanation on how to make, a quarto reveal, uh, presentation with this extension.
So that's basically what we decided to do for this one. And, uh, in the past, we were just putting like random content in it, just as an example. And people were like, oh yeah, but how do I do this? How do I do that? And we thought that, you know, providing a minimal, set the basic things that you can do with the extension makes it a way easier for people to then use it and not having to, you know, go back.
Especially, you know, Really specific things that when you have to call, class that is specific to UNHCR that is not present somewhere else. So that we thought that was a good way of, presenting the, how to do it to the user, strikes in the template, meaning that then we would probably have to.
Delete everything that's in the template to work on their own. But, uh, yeah, I guess 90 percent of the time, anyway, it's the case. People will remove everything that's in the template to do their own. And can you just
[00:42:44] David Keyes: show me briefly, like flip over, say to RStudio and show me, you know, someone's working in a project, what it looks like to be able to use your, your template that you've created?
[00:42:54] Cédric Vidonne: Yeah, sure. Um, there are two ways of kind of like starting to use those, um, those extension. If you go back to the, um, to the extension itself. Either install it and get the template Mm-Hmm, , or you can also install it on your.
Already existing, uh, already existing projects. So if you use, uh, this call from quarto in the terminal, it will actually create, create a new template for you. It will call the whole, uh, extension. So use template will actually ask me to create a subfolder. Uh, if my internet is working, yes, I trust myself, I will create sub directory and demo, and here it will unzip the whole extension.
And it will actually create, uh, uh, a new demo, uh, folder and I think where basically I have the demo QMD, and if I run this demo QMD, it will create exactly the same result as what we've seen here. So all the different, uh, thing. And as you can see in the, in the YAML, I have now the format unhr reveal that is going to go for all the resources that are under this.
So at this point, the user
[00:44:16] David Keyes: could just, you know, render this, I mean, obviously they'd want to change the content, but they could render this, see that sample presentation and then delete the default content and add their own content and it would all be on brand. Is that right?
[00:44:32] Cédric Vidonne: Yes. Yes, exactly. So if I run this one or I can even, I just ran it, but yeah, I could delete some of the content.
But basically it will. Render my QMD file and it will create this. branded presentation using the blue from UNHCR, the color, the font, the styles that we've implemented in the SAS. I know what I, I know I have an error here. I know why. Let me remove a bit of the content, but the
plot is, he's not happy with the plot for some reason.
So, if I run this, It's,
it would be faster anyway.
[00:45:17] David Keyes: Does it have Python in it?
[00:45:20] Cédric Vidonne: No, what's going on? It's always like this. I run this this morning. It was working perfectly. And, uh,
[00:45:30] David Keyes: I don't think it's that big a deal, to be honest. Like you, cause you already showed it.
[00:45:34] Cédric Vidonne: I added, I added prepared, but what I, what I actually wanted to, to, to say, it's that basically, You can also run, um, instead of, of, of using the template, you can actually install the extension directly in your folder. And basically you can, you can start with, this, default, uh, simply that is a default reveal GS, presentation.
And then by just installing the extension locally on your machine and calling it, uh, in the terminal, you can basically in, in one line of code, it will install this extension in your folder. And then instead of getting the default, extension, you will get the, uh, it's working.
I don't know what the Python thing. created that. So that's what you get with a default, uh, QMD. If you do a reveal. js, if I just install my, my, uh, my extension and, and, and I applied this, uh, and, and instead of calling the reveal. js that I have here, I called the UNHCR reveal and I run this one. It's exactly the same file.
I haven't changed anything. It will basically re render the same presentation. But with, um,
Yeah,
[00:46:58] David Keyes: that's good. I mean, it just shows kind of like how easy it is to, for a user, I mean, obviously you put in the work up front, but then for a user, they change one line and it's all on brand. Yeah.
[00:47:09] Cédric Vidonne: Yeah. And, uh, I think that was the, that was the night is, so you see, it's exactly the same, uh, presentation.
And so, and then. Now, in conjunction with the UNHCR team, I had actually a third, uh, example where basically then you apply the theme to this ggplot and you have a default UNHCR branded presentation of statistics that you can go and just show to senior management. And if the data changes 20 times, it doesn't matter.
You just re render it and you have your, your newly updated presentation out of the box. That's it. That's
[00:47:46] David Keyes: the idea of GitHub. Yeah, well, that's great. I mean, that's such a good example, then, of how they kind of, you know, fit together. You can have individual plots within the presentation and then the template that wraps them together.
I have it here, but if
[00:48:01] Cédric Vidonne: I open it here, you probably see it. So that's exactly the same again. And here, yeah, you can see. So that's, that's, you know, out of the box, it's just, you don't have to think about the design. Yeah, that's great for you. So that's the whole idea.
[00:48:17] David Keyes: Um, well, awesome. This has been really interesting to see, you know, the development of both the theme as well as the quarto extension.
Um, I think it's great to see, you know, how you can use various
tools within the kind of R sphere to, to keep everything, uh, on brand. If people want
to learn more about this or learn more, um, you know, about the work you do at UNHCR, we'll obviously post some links, are there particular Places, um, or places you would point people
to. Well, I think for, for everything related to what we did today, it's definitely the data viz platform is the go to place where you can also find all the different links to our different R tool that we've made, the templates, the packages and everything like this. And we also showcase other type of packages, like the more data centered packages that Amadou talked about the previous time, you know, all the statistic data that we have that is, that is packaged into some, some R package. So that's, that's a good And, uh, yeah.
[00:49:22] Cédric Vidonne: And, and I wish that in the future we can go even further and really, you know, work on more, I would definitely would like to pick up your brain, maybe another time to, you know, see how you work on parameterized reporting and stuff like this and, and layout, unfortunately, I haven't had time to play a bit with tips.
But I think it's something I created a quarto extension for Page.js also, but, uh, because at the beginning I thought it was the direction that Posit was taking, but it seems that it's not going to be the case. So probably tips will be the way to go, but I haven't had time to really play with it. But, uh I think we could create really nice, layouts that people can use.
[00:50:02] David Keyes: Because yeah, people love PDF in our org type organization. PDF is still what people want. They want to be able to print it, go to a meeting with it, show it And so that's
Yep, definitely. Well, I'll post a link to that as well. If people want to see kind of how you've been playing around with making PDFs using,
[00:50:20] Cédric Vidonne: um,
[00:50:20] David Keyes: the Page.js JavaScript library. So
great. Well, Cedric, thank you so much for joining us. I really appreciate it.
[00:50:26] Cédric Vidonne: Thank you for having me. And it was a pleasure to be here.
Sign up for the newsletter
Get blog posts like this delivered straight to your inbox.
You need to be signed-in to comment on this post. Login.