LoslegenKostenlos loslegen

Heat map alternatives

There are several alternatives to heat maps. The best choice really depends on the data and the story you want to tell with this data. If there is a time component, the most obvious choice is a line plot.

Diese Übung ist Teil des Kurses

Intermediate Data Visualization with ggplot2

Kurs anzeigen

Interaktive Übung

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

# The heat map we want to replace
# Don't remove, it's here to help you!
ggplot(barley, aes(x = year, y = variety, fill = yield)) +
  geom_tile() +
  facet_wrap( ~ site, ncol = 1) +
  scale_fill_gradientn(colors = brewer.pal(9, "Reds"))

# Using barley, plot yield vs. year, colored and grouped by variety
___ +
  # Add a line layer
  ___ +
  # Facet, wrapping by site, with 1 row
  facet_wrap( ~ site, nrow = 1)
Code bearbeiten und ausführen