LoslegenKostenlos loslegen

Plot and axis titles

In the previous two exercises, you saw a set of subplots that lack any axis labels and a set of subplots that used the column names as axis labels. Why are they different? By default, the subplot() command sets titleX = shareX and titleY = shareY; thus, axis labels are only displayed if shareX and/or shareY are TRUE. You can add titleX = TRUE and/or titleY = TRUE to override this behavior.

In this example, your task is to add titles to subplots. Note that plotly has already been loaded for you.

Note: When you run your solution, you will see two warning messages about ignoring observations. These messages simply indicate that plotly is ignoring missing values.

Diese Übung ist Teil des Kurses

Interactive Data Visualization with plotly in R

Kurs anzeigen

Anleitung zur Übung

  • Adapt the subplot() code to allow the x- and y-axis titles to be shared.
  • Add the title "User score vs. critic score by platform, 2016" to the plot.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Add x-axis and y-axis labels, and a title
subplot(p1, p2, nrows = 2, ___, ___) %>%
   ___
Code bearbeiten und ausführen