Personalizarea aspectului

Vizualizare interactivă a datelor cu plotly în R

Adam Loy

Statistician, Carleton College

layout()

  • axe: tip, etichete, marcaje, transformări etc.
  • legendă: poziție
  • fundal: linii de grilă, culoare de fundal
  • dimensiune: înălțime, lățime, margini
Vizualizare interactivă a datelor cu plotly în R

Etichete axe

winequality %>%
  plot_ly(x = ~free_so2, y = ~total_so2) %>%
  add_markers(marker = list(opacity = 0.2)) 
Vizualizare interactivă a datelor cu plotly în R

Etichete axe

winequality %>%
  plot_ly(x = ~free_so2, y = ~total_so2) %>%
  add_markers(marker = list(opacity = 0.2)) %>%
  layout(xaxis = list(title = "Free SO2 (ppm)"),
         yaxis = list(title = "Total SO2 (ppm)"))
Vizualizare interactivă a datelor cu plotly în R

Titluri

winequality %>%
  plot_ly(x = ~free_so2, y = ~total_so2) %>%
  add_markers(marker = list(opacity = 0.2)) %>%
  layout(xaxis = list(title = "Free SO2 (ppm)"),
         yaxis = list(title = "Total SO2 (ppm)"),
         title = "Does free SO2 predict total SO2 in wine?")
Vizualizare interactivă a datelor cu plotly în R

Transformarea axelor

winequality %>%
  plot_ly(x = ~free_so2, y = ~total_so2) %>%
  add_markers(marker = list(opacity = 0.2)) %>%
  layout(xaxis = list(title = "Free SO2 (ppm, log scale)", type = "log"),
         yaxis = list(title = "Total SO2 (ppm, log scale)", type = "log"),
         title = "Does free SO2 predict total SO2 in wine?")
Vizualizare interactivă a datelor cu plotly în R

Personalizarea grilei

Vizualizare interactivă a datelor cu plotly în R

Personalizarea grilei

winequality %>%
  plot_ly(x = ~free_so2, y = ~total_so2) %>%
  add_markers(marker = list(opacity = 0.5)) %>%
  layout(xaxis = list(title = "Free SO2 (ppm)", zeroline = FALSE),
         yaxis = list(title = "Total SO2 (ppm)", zeroline = FALSE, 
                      showgrid = FALSE))
Vizualizare interactivă a datelor cu plotly în R

Personalizarea fundalului

24_bgcolor.png

winequality %>%
  plot_ly(x = ~free_so2, y = ~total_so2) %>%
  add_markers(marker = list(opacity = 0.5)) %>%
  layout(xaxis = list(title = "Free SO2 (ppm)"),
         yaxis = list(title = "Total SO2 (ppm)"),
         plot_bgcolor = toRGB("gray90"),

paper_bgcolor = toRGB("skyblue"))
Vizualizare interactivă a datelor cu plotly în R

Să exersăm!

Vizualizare interactivă a datelor cu plotly în R

Preparing Video For Download...