Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Know your problem
Know your data
Visualise your data
Work with your chart
16. Adding color to bars
Check yourself


Our bar chart currently has grey bars that aren't very eye-catching. However, they are the most important part of the chart, so let's make them stand out. Let's add some color to them.

While choosing bar color, avoid excessively loud or bright colors, like this intense fluorescent green:


Colors that are too aggressive are hard to read and are not visually pleasing. Remember, we want the data to be the star of the chart, not our color selection!

So how can we change the bar color?

We add the geom_col() command by adding the fill argument, like this:


You can enter colors by name. For example, if you wanted blue columns, you'd write:


As with HTML and other programming languages, you will need to refer to a color chart to find a name (that R will recognize) for the color you want.


Change the color of the bars in our barplot to make them stand out. Add the appropriate command and argument.

You can use any color in the Color card located on the right sidebar. Just click on your color choice and you'll see its name. Enter that name into the fill argument.

When you're done, press the Run and Check Code button to check your code.

Stuck? Here's a hint!

You can write (for example):

geom_col(fill = "deepskyblue3")