BaşlayınÜcretsiz Başlayın

plot() function - basic parameters (2)

You can add even more customization with the plot() function using other options. As you saw in the video, the lines() function is especially helpful when you want to modify an existing plot.

Let's look at another example:

> # Use bars instead of points and add subtitle
> plot(mydata, type = "h", sub = "Subtitle")

> # Triple thickness of line and change color to red
> lines(mydata, col = "red", lwd = 3)

In this exercise, you will try some of this customization for yourself. The same dataset, data, is available in your workspace. (If you can't remember the names of the columns, run colnames(data) in your console.)

Bu egzersiz

Visualizing Time Series Data in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Plot the second time series in data and change the title of the chart to "microsoft"
  • Replot with same title, include subtitle "Daily closing price since 2015", and use bars instead of points for the chart type
  • Change the color of the line to red without creating a new plot

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Plot the second time series and change title


# Replot with same title, add subtitle, use bars


# Change line color to red
Kodu Düzenle ve Çalıştır