View source: R/scatterPlotMatrix.R
highlightPoint | R Documentation |
Asks to change the highlighted row.
highlightPoint(id, pointIndex)
id |
output variable to read from (id which references the requested plot) |
pointIndex |
index of the point to highlight; |
No return value, called from shiny applications for side effects.
if(interactive() && require(shiny)) {
library(shiny)
library(scatterPlotMatrix)
ui <- fluidPage(
actionButton("highlightPointAction", "Highlight Last Point"),
actionButton("clearHlPointAction", "Remove Highlighting"),
p("These buttons sets/unsets a selected line"),
scatterPlotMatrixOutput("spMatrix")
)
server <- function(input, output, session) {
output$spMatrix <- renderScatterPlotMatrix({
scatterPlotMatrix(iris)
})
observeEvent(input$highlightPointAction, {
lastRowIndex <- nrow(iris)
scatterPlotMatrix::highlightPoint("spMatrix", lastRowIndex)
})
observeEvent(input$clearHlPointAction, {
scatterPlotMatrix::highlightPoint("spMatrix", NULL)
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.