Is it possible with ggvis to interactively change the variables for the x and y axes?

后端 未结 5 1072
日久生厌
日久生厌 2020-12-31 04:46

Does anyone know if it is possible to change the variables for the x and y axis interactively with ggvis? I can change the size of the data points, their position and opacit

5条回答
  •  心在旅途
    2020-12-31 05:10

    Yes. You could do as follows:

    library(ggvis)
    
    mtcars %>% 
      ggvis(x = ~mpg, y = input_select(label = "Choose what to plot:",
                                       choices = names(mtcars),
                                       selected = "cyl",
                                       map = as.name)) %>% 
      layer_points()
    

    If you want to select both variable just do the same for x.

提交回复
热议问题