How to create your first line chart
This is a very detailed tutorial on how to create and play around with your very first line chart in Datawrapper.
In this Academy article, you will learn how to build a Datawrapper line chart to show the unemployment rate in Europe in the past few years. This is what it will look like:
How to get the data
Every data visualization needs data, so that’s what we need to take care of first.
In this exercise, we’ll use data from The World Bank Open Data portal.
Go to their website and search for “unemployment” – and you should see some immediate suggestions by The World Bank, then choose the first one: “ Unemployment, total (% of the total labor force) (modeled ILO estimate)”.
“ ILO” is the International Labor Organization and a United Nations agency, and “Estimate” is a hint that they’ll give us the numbers for the most recent or even the current year.
How to download the data
To get the data for each country, we can find the Download section in the sidebar.
You have three options for downloading the data: a CSV, XML, or Excel file.
CSV stands for “comma-separated values”. It’s a simple text file in which each row is a line and the cells in each line are separated by commas.
XML is a fairly old format that looks a bit like HTML code. The World Bank also offers Excel, which is a format most of you probably know which we'll use for this exercise.
Datawrapper understands CSV data and Excel data, and the longer you’ll work with data, the more often you’ll want to choose CSV over Excel since CSV has some advantages.
Click on “Excel”, and the Excel file with the data will download to your Downloads folder.
This is how the data looks like. First, we need to clean the data.
How to clean up the data
You can open the downloaded Excel file in Excel, Open Libre, or Google Sheets but let's use Google sheets for this tutorial.
Go to sheets.new to open a new Google Spreadsheet document; then give it a proper name. Then import the Excel file by clicking on “File” > “Import” and then “Upload”.
Click “Replace spreadsheet”, then “Import”, and you should see your data in Google Sheets.
Our goal is to clean up the data so that we can copy & paste it to Datawrapper; so we will remove everything unnecessary from this spreadsheet.
Each data set you upload to Datawrapper needs to have the header in the first row, so let's get rid of the first three rows. You can also delete unnecessary columns like the country code or the indicator name and indicator code.
Also, our data doesn’t properly start until 1991, so you can delete all year columns before 1991.
Now, you can see from the image above that this is way too many countries for a line chart. You only want to show the unemployment rate in Europe, so let’s look for some European countries and get rid of the rest of the rows. You can decide which ones you’d like to keep.
Now it looks like the data is tidy enough to be copied & pasted into Datawrapper.
Upload the data
Open datawrapper.de in your browser and click on the "START CREATING" button. You can use Datawrapper without being signed in, but you will need to sign up to publish the chart you built.
Here you can see four steps on the top: Upload Data, Check & Describe, Visualize, and Publish & Embed.
Let's go through them step by step.
Step 1: Upload Data
In step 1, Datawrapper will ask you what kind of data you want to upload.
There are a few options to upload your data but because we already prepared our data, we can simply paste the data we just copied in the white text field at the right. (For the other options, visit another academy article " How to upload data")
It looks a bit chaotic right now, but don’t worry, it’ll be tidied up and readable once you go to the next step, Check & Describe. To do so, click on “Proceed” in the bottom right.
Step 2: Check & Describe
You can see that the columns are differently colored. The first column is black – that tells us that Datawrapper recognizes this column as a text column. Great! That’s what it is. The following columns are blue, which means Datawrapper thinks these are columns filled with numbers. That’s also right, so it seems like we’re good to go.
When you’re creating data visualization, it’s always helpful to know if Datawrapper understands the values you uploaded. Make sure the columns are in the right color before continuing.
Ok, let’s do that; let’s continue. Click on “Proceed” in the lower-left to go to step 3: “Visualize”.
Step 3: Visualize
Datawrapper by default always selects a line chart.
But you can see that there are many other chart types available: bar charts, area charts, pie charts, and more uncommon ones like dot plots and scatter plots.
Unfortunately, the default line chart will look strange: The countries seem to be on the x-axis, and the years are shown with lines and what we want is to have them the other way around!
Datawrapper has an inbuilt feature that can help us change this. It’s called “ Transpose the data”, and you will find it at the bottom of the chart type grid.
When we transpose data, columns become rows and rows become columns. Now you have a proper line chart, with years on the x-axis and countries as lines!
Let’s make the data more readable. To do so, click on the “ Refine” tab at the top.
This brings you to a page on which there are a lot of different settings. First, let's change the colors by scrolling down until you find the option “ customize colors” right below “Customize lines”.
Click on “ Customize colors”. This will open a list of countries, and we can color each of them differently by clicking on each country, then click on the little color rectangles that appears to its right.
You would want a few countries to really stick out, but to do so, you first can give each country the same color.
Click on “ Select: all” on the bottom of the country list, then choose a nice grey.
Now we can click on individual countries and change their colors. In this tutorial, let's highlight Greece and Spain because they are the two biggest outliers. Let's also highlight Germany since Datawrapper is based in Germany and German readers will want to know how they compare to the outliers and the rest of the countries.
People will always want to find themselves, their country, region, profession, age, etc. in a chart, so make sure to highlight it for them.
Be careful not to clutter the chart with too many colors - it will make the chart less readable. Also, when choosing colors, be aware that some people are colorblind or colorweak - meaning some people won't be able to distinguish colors as well as you do. Here's a two-part comprehensive blog-post on colorblindness on our blog Chartable for further reading: part 1, part 2.
To make our colored countries stand out even more, you can increase their line width.
You will find the option to do that below the color picker. Click on the countries which lines you want to make thicker.
Click on the name of the country multiple times to change the thickness – click one time and it becomes thicker, two times and it becomes 0px (which is great for hiding lines!), three times and it becomes thicker again, etc.
Below the line width and the line dashes are the “ interpolation” option. “Interpolation” describes how the data points are connected with our lines. You have some options there, like stepped or curved.
Ideally, the interpolation shows how the data behaves in the real world. Here, let's choose the “ Curved” option because we have yearly data, but “Linear” is a good choice, too. If we’d show monthly data, there could be a case made for the stepped interpolation, since employment often begins or end at the end of a month.
And since we have so many lines, labeling them directly on the right means they overlap easily. Let’s turn the line labels off for now with a click on “Line labels: none”.
When we first got into the settings, we jumped over the options for the horizontal and vertical axis on the top. Let’s scroll up again to have a look. You can change a lot here to your liking – like the grid labels, gridlines, etc.
What we should definitely do is to change the number format of the vertical axis. Right now it just says “15, 20, 25” – but 15, 20, 25 what? We can select the number format “0%” to make clear these numbers are percentages.
Nice! Let’s look at what we created so far. I’m happy with how the chart looks like, but if somebody saw the chart for the first time, they would be puzzled what it was about. Let’s change that.
Let's go to the next tab on the top, “ Annotate”.
There we have the options to give our chart:
- notes (footnotes)
- data source
Let's start with the description; describing to the reader what kind of data they can see on the chart. In this case, it’s the unemployment rate in % of the total labor force, 1991-2019. Try to be as precise as possible in these descriptions, but make sure to not use words the readers can’t possibly understand.
For example, it would be nice if you were to explain in the description, what unemployment rate means since it can be defined differently. You can find some information about how it’s defined in your data in the metadata in the Excel file you downloaded in the beginning. There it says: “Unemployment refers to the share of the labor force that is without work but available for and seeking employment.”
You can decide if you want to add this explanation to your description but remember to be concise!
Definitely add your source and a link to the data source, so that your readers can explore the data themselves if they’d like to investigate this topic further. And don't forget to add a byline too!
Add your name, so that everyone knows which great data visualizer created this chart!
And last but not the least, the title.
The description already says what kind of data we see in the chart; so you can use the title to communicate (in words) what you can read out visually from the chart.
Ok, now that the financial crisis is mentioned in the title, you should definitely show on the chart when it happened.
“ Highlighted value ranges” are perfect for that.
At the bottom of the page, click on “ Add range highlight”, then click in the chart at some point in 2007 and click again in 2008. This will draw the value range.
Don’t worry, you can still change the data range. And you change the color and opacity, or delete the value range with a click on the little trash bin, in case you want to try again.
Now our readers know what the chart is about, but they don’t have any clue which line stands for which country.
Here, you can make creative use of t ext annotations and use them as labels.
To do so, click on “ Add text annotation”.
Clicking on “ Add text annotation” will open a few options. Type in the name of your label, like “Spain”. Then click at some point on the chart to position the annotation (don’t worry, you can still change it later!).
Once you’ve done that, click on the little downwards arrow to open formatting options.
This way, you can change the color of the font to give it the same color as the line. You can also make the text bolder or bigger.
Once you’re happy, create the labels for Greece and Germany!
You can always change the position of the annotations again with a click on the little arrow left of the text field.
And here’s a pro tip: You can change the alignment of the text annotation with a click on the little square on the left.
This way, the Spain label always has the same distance to the Spain line, no matter if the reader is seeing the chart on a desktop computer, tablet, or mobile phone.
Make sure that the annotations work on all devices - you can check how your chart looks like on different screens with the three buttons down here.
You can also hide text annotations on either mobile phones or desktop computers directly in the “Text annotations” options. This can be done by unchecking the ‘’show on mobile’’ or ‘’show on desktop’’ option.
Alternatively, you could make custom text annotations for desktop vs mobile screens for the same chart. For example, you could create a small text annotation for mobile screens and hide them on desktop screens, and a bigger annotation for desktop screens and hide it for mobile screens.
Once you’re happy with the colors, title, descriptions, and annotations on your chart – we're ready to publish!
How to publish your chart
To publish, click on the arrow for “ step 4: Publish & Embed”.
You will see your chart again, and a big button that says “ Publish chart”. As soon as you click on that button, your chart becomes visible for the public, and you can embed it, or share it on social media.
Once you hit the "publish" button, you have a number of Share & Embed options.
The “ responsive iframe” is great for embedding your chart in an online article because the responsive iframe will make sure that the chart looks great on all kinds of devices, from narrow mobile phones to wide desktop computers.
If you want to share your chart on social media or just in an email to a coworker, we can choose the “Share via URL” option and then click on “normal size”.
When you click on the URL, you'll see your chart on a new page.
Try to hover over the data, and you will notice that the chart is interactive, too!
And that’s it! Congratulations on creating your first Datawrapper line chart, and thank you so much for following this tutorial.
Do you have questions about options in a specific chart type? Click on the categories to the left of this Academy article to find out more about pie charts, bar charts, dot plots, etc.
To find out more about Datawrapper in general, go to our website. And if you have any questions, we're always happy to help at firstname.lastname@example.org.