開始使用免費開始

了解 plotly 的限制

你已經看到有些 ggplot 繪圖無法直接轉換成 Plotly 物件。舉例來說,使用 ggplot2 繪製的水平箱形圖,無法直接轉成水平的 plotly 箱形圖。必須先繪製垂直方向的 ggplot 箱形圖,再進行座標翻轉。

在接下來的練習中,你會修正一些 Plotly 繪圖,讓它們正確呈現。你也會看到 Plotly 的一些限制。

London Airbnb 資料集已經以資料框 listings 提供,且已為你載入 tidyverseplotly 套件。

本練習屬於課程

使用 shinydashboard 建立儀表板

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Modify to obtain a set of vertical boxplots
boxplots <- listings %>%
  ggplot(aes(x=reviews_per_month, y=room_type)) +
  geom_boxplot() +
  theme_classic()

# Obtain a horizontal set of plotly boxplots
___
編輯並執行程式碼