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

Adding background text

In the previous lesson, you polished your animated bubble chart of housing price index against real GDP. In this exercise, you will continue to polish this graphic by displaying the year in the background of the animation.

Bu egzersiz

Intermediate Interactive Data Visualization with plotly in R

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

Egzersiz talimatları

  • Add the year as background text. You should center the text at the point (200000, 450), set the font color to gray80, and set the font size to 150.
  • Use animation_slider() to hide the slider.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Add the year as background text and remove the slider
us_economy %>%
  plot_ly(x = ~gdp, y = ~house_price, hoverinfo = "text", text = ~state) %>%
  add_text(x = ___, y = ___, text = ___, frame = ___,
           textfont = list(color = ___(___), size = ___)) %>%
  add_markers(size = ~population, color = ~region, 
              frame = ~year, ids = ~state,
              marker = list(sizemode = "diameter", sizeref = 3)) %>%
  layout(xaxis = list(title = "Real GDP (millions USD)", type = "log"),
         yaxis = list(title = "Housing price index")) %>%
  ___(___ = ___)
Kodu Düzenle ve Çalıştır