Labeling your data

Interactive Data Visualization with plotly in R

Adam Loy

Statistician, Carleton College

23_default_scatter.gif

Interactive Data Visualization with plotly in R

23_default_bar.gif

Interactive Data Visualization with plotly in R

23_default_box.gif

Interactive Data Visualization with plotly in R

Changing the default

 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"
Interactive Data Visualization with plotly in R

Custom hover text

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

hoverinfo = "text",
text = ~paste("Flavanoids:", Flavanoids, "<br>", "Alcohol:", Alcohol)
) %>% add_markers()
  • tilde, ~, to map columns to aesthetic parameters

Interactive Data Visualization with plotly in R

Let's practice!

Interactive Data Visualization with plotly in R

Preparing Video For Download...