Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Visualize your data - pie charts
Work with your chart
17. Remove unnecessary elements
Check yourself

## Instruction

Avoid clutter. Remove all unnecessary elements from your chart.

We should always check whether all the elements on our chart are needed. We may have two different elements that serve the same purpose. In such cases, we should remove one. Your goal is to tell the data's story as clearly as you can. That often means keeping your chart simple and uncluttered.

In the previous exercise, we added value labels to the chart. We now have two ways to read data: by the value labels and by the grid ticks (shown around the outside of the pie). We will remove the ticks. We don't need them anymore, and the value labels are clearer anyway.

To remove chart elements, we set them to blanks. We do this using the element_blank() argument in the theme() function. For example, if we want to remove all of the grid from a chart, we enter this command:

+ theme(panel.grid = element_blank())

If we want to remove another element, we use similar code and separate each option with a comma, as shown here:

+ theme(OPTION1 = element_blank(), OPTION2 = element_blank(), ...)

## Exercise

Remove the grid and its axis titles, text, and ticks from the chart. Add (+) theme() command to the pie object and change the following options to blanks:

• Grid lines: panel.grid
• Axis title: axis.title
• Axis ticks: axis.ticks
• Axis text: axis.text

When you're done, press .

### Stuck? Here's a hint!

You should write:

theme(panel.grid = element_blank(), axis.text = element_blank(),
axis.ticks = element_blank(), axis.title = element_blank())