zoo and ggplot2
zoo
objects, much like data frames, can be visualized with functions from the ggplot2
package. While this course doesn't go into too much detail regarding ggplot2
plots and functions, it's nonetheless helpful to review the syntax for more advanced plotting techniques than using autoplot()
alone.
In this exercise, you'll explore using zoo
and ggplot2
together. You'll take the card_prices
time series from the previous exercise and generate a ggplot
, complete with proper labels, a title, and a theme!
zoo
, ggplot2
, and card_prices
are available to use.
Diese Übung ist Teil des Kurses
Manipulating Time Series Data in R
Anleitung zur Übung
Within the call to
aes()
, enter the appropriate mappings to the x and y axes.Plot the time series as a line, with the color in red.
Use the light theme from
ggplot2
Include the axis labels and title:
"Index"
for the x-axis,"Price (EUR)"
for the y-axis, and"Daily Card Prices for Trading Card Game"
for the title.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Enter the x and y axis mapping aesthetics
ggplot(card_prices, aes(x = ___, y = ___)) +
scale_y_continuous() +
# Plot the data with a red-colored line
___ +
# Use the light theme
___ +
# Enter the appropriate axis labels and title
labs(
___
)