Activity: Using Color Differentiation in Plots

Scenario

Suppose that a loan company has given loans to people with different features (for example, employment status, home ownership, credit grade, and so on), and you want to see the relationships between some of those variables.

Aim

To view the distribution of loan amount versus home ownership using a plot with color differentiation on the basis of credit grade.

Steps for Completion

  1. Use the LoanStats dataset and make a subset.
  2. Clean the dataset (removing the NONE and NA cases).
  3. Create a boxplot showing the loan amount versus home ownership.
  4. Color differentiate by credit grade.

The following plot should be obtained:

Get Applied Data Visualization with R and ggplot2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.