У меня есть точечная диаграмма с добавленным флажком через bscols crosstalk (). Когда я выбираю, скажем, Animal_Biology, Bioinformatics_Computational_Biology и Cell_Biology из раскрывающегося меню, я бы хотел, чтобы на диаграмме разброса были показаны ТОЛЬКО исследователи (точки данных), которые участвуют в этих трех темах, а не все во всех трех областях исследования. ,Любые идеи, как я могу достичь этого? Спасибо заранее и любая помощь / предложение высоко ценится.
Оскар.
### create ShareData object
`shared_data <- indPlotlyMetadataLong %>% SharedData$new()
mcaPlot <- shared_data %>%
plot_ly(x = ~Dim.1 , y = ~Dim.2, alpha = 0.9, text = ~researcher,),
color = ~research_field,
marker = list(size = 11),
hoverinfo = "text") %>%
add_markers() %>%
highlight(persistent = TRUE) %>%
hide_legend() %>%
layout(title = "MCA of CSB data",
xaxis = list(title = "PC 1", range = c(-1, 1.2)),
yaxis = list(title = "PC 2", range = c(-1, 1.2)))
### Add checkboxes to mcaPlot
bscols(widths = c(4, 8),
filter_checkbox(id = "research_field", label = "Select a research field",
sharedData = shared_data, group = ~research_field,
allLevels = TRUE, inline = FALSE, columns = 2),
mcaPlot)`
Here is my indPlotlyMetadataLong data -used to create shared_data:
structure(list(Dim.1 = c(0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751,
0.154663044922868, 0.039412348935979, -0.238553016168864, -0.857636033313211,
0.136180995471785, -0.023405229926155, 0.309675654958752, 0.956678913668931,
-0.402039082922732, -0.083222278467751, 0.154663044922868, 0.039412348935979,
-0.238553016168864, -0.857636033313211, 0.136180995471785, -0.023405229926155,
0.309675654958752, 0.956678913668931, -0.402039082922732, -0.083222278467751
), Dim.2 = c(0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473, 0.282285353128673,
-0.111166763161315, -0.505836530845472, 0.271456399109778, -0.170820535747068,
0.585172813105297, 0.347440487953943, -0.242846745355895, 0.450494439934673,
-0.527719500890473, 0.282285353128673, -0.111166763161315, -0.505836530845472,
0.271456399109778, -0.170820535747068, 0.585172813105297, 0.347440487953943,
-0.242846745355895, 0.450494439934673, -0.527719500890473), researcher = c(1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), research_field = c(NA,
NA, "Animal_Biology", "Animal_Biology", "Animal_Biology", "Animal_Biology",
NA, NA, NA, "Animal_Biology", NA, NA, NA, NA, "Bioinformatics_Computational_Biology",
"Bioinformatics_Computational_Biology", "Bioinformatics_Computational_Biology",
NA, NA, NA, "Biotechnology", NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, "Cell_Biology", "Cell_Biology", NA, NA, NA, NA, NA,
"Cell_Biology", NA, NA, NA, NA, NA, NA, NA, "Chemical_Biology",
NA, NA, NA, "Developmental_Biology", "Developmental_Biology",
NA, "Developmental_Biology", NA, NA, "Developmental_Biology",
NA, "Developmental_Biology", NA, NA, NA, NA, NA, "Evolutionary_Biology",
NA, NA, NA, NA, "Genetics", NA, "Genetics", NA, "Genetics", NA,
NA, "Genetics", NA, "Genetics", NA, NA, NA, NA, "Genomics", "Genomics",
NA, "Genomics", NA, "Genomics", NA, NA, NA, NA, NA, NA, NA, NA,
"Lecturer", NA, NA, NA, NA, NA, NA, NA, "Metabolomics", NA, NA,
NA, "Microbiology", NA, NA, NA, NA, NA, NA, "Microbiology", NA,
NA, "Molecular_Biology", "Molecular_Biology", "Molecular_Biology",
NA, "Molecular_Biology", "Molecular_Biology", "Molecular_Biology",
"Molecular_Biology", NA, "Molecular_Biology", NA, NA, NA, "Neurobiology",
"Neurobiology", "Neurobiology", NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, "Pathology", NA, NA, NA, NA, NA, "Physiology", NA,
NA, NA, NA, NA, NA, NA, "Plant_Biology", NA, NA, NA, NA, "Plant_Biology",
"Plant_Biology", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, "Structural_Biology", NA, NA, NA, NA, NA, NA, NA, "Systems_Biology",
NA, NA, "Systems_Biology", NA, NA)), row.names = c(1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 34L, 35L, 36L, 37L, 38L, 39L, 40L,
41L, 42L, 43L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L,
100L, 101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L, 133L,
134L, 135L, 136L, 137L, 138L, 139L, 140L, 141L, 142L, 166L, 167L,
168L, 169L, 170L, 171L, 172L, 173L, 174L, 175L, 199L, 200L, 201L,
202L, 203L, 204L, 205L, 206L, 207L, 208L, 232L, 233L, 234L, 235L,
236L, 237L, 238L, 239L, 240L, 241L, 265L, 266L, 267L, 268L, 269L,
270L, 271L, 272L, 273L, 274L, 298L, 299L, 300L, 301L, 302L, 303L,
304L, 305L, 306L, 307L, 331L, 332L, 333L, 334L, 335L, 336L, 337L,
338L, 339L, 340L, 364L, 365L, 366L, 367L, 368L, 369L, 370L, 371L,
372L, 373L, 397L, 398L, 399L, 400L, 401L, 402L, 403L, 404L, 405L,
406L, 430L, 431L, 432L, 433L, 434L, 435L, 436L, 437L, 438L, 439L,
463L, 464L, 465L, 466L, 467L, 468L, 469L, 470L, 471L, 472L, 496L,
497L, 498L, 499L, 500L, 501L, 502L, 503L, 504L, 505L, 529L, 530L,
531L, 532L, 533L, 534L, 535L, 536L, 537L, 538L, 562L, 563L, 564L,
565L, 566L, 567L, 568L, 569L, 570L, 571L, 595L, 596L, 597L, 598L,
599L, 600L, 601L, 602L, 603L, 604L, 628L, 629L, 630L, 631L, 632L,
633L, 634L, 635L, 636L, 637L, 661L, 662L, 663L, 664L, 665L, 666L,
667L, 668L, 669L, 670L), class = "data.frame")