Activity: Applying Grammar of Graphics to Create a Complex Visualization

Steps for Completion:

  1. Use the commands that we just explored to create the scatterplot.
  2. For this activity, you will use the gapminder dataset.
  3. You can use the help command to explore the options.
  4. To change scales, you will have to use one of the preceding label formats.
  5. Use labels=scales::unit_format ("K", 1e-3)) for labeling.

Outcome:

The output code is as follows:

ggplot(df, aes(x=gdp_per_capita,y=Electricity_consumption_per_capita))+
geom_point()+
scale_x_continuous(name="GDP",breaks = seq(0,50000,5000),
labels=scales::unit_format("K", 1e-3)) +
scale_y_continuous(name="Electricity Consumption",
breaks = seq(0,20000,2000),
labels=scales::unit_format("K", 1e-3))
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.1.232