Märk upp dina data

Interaktiv datavisualisering med plotly i R

Adam Loy

Statistician, Carleton College

23_default_scatter.gif

Interaktiv datavisualisering med plotly i R

23_default_bar.gif

Interaktiv datavisualisering med plotly i R

23_default_box.gif

Interaktiv datavisualisering med plotly i R

Ändra standardinställningen

 wine %>%
  count(Type) %>%  
  plot_ly(x = ~Type, y = ~n,
      # Changing the default info displayed
          hoverinfo = "y" 
  ) %>%
  add_bars()

hoverinfo =

  • "all"
  • "x"
  • "y"
  • "x+y"
  • "x+y+z"
Interaktiv datavisualisering med plotly i R

Anpassad hover-text

wine %>%
  plot_ly(x = ~Flavanoids, y = ~Alcohol,

hoverinfo = "text",
text = ~paste("Flavanoids:", Flavanoids, "<br>", "Alcohol:", Alcohol)
) %>% add_markers()
  • tilde, ~, för att mappa kolumner till estetiska parametrar

Interaktiv datavisualisering med plotly i R

Nu kör vi en övning!

Interaktiv datavisualisering med plotly i R

Preparing Video For Download...