show subplot in tooltip on hover in scatterplot in Rbokeh

374 views Asked by At

I am generating an interactive scatterplot with Rbokeh. My data is stored in a data.table.

data(iris)
library(data.table)
dt.iris <- data.table(iris)
library(rbokeh)
figure() %>%
  ly_points(Sepal.Length, Sepal.Width, data = dt.iris, 
            hover = c(Petal.Width, Petal.Length,Species)) 

Rather than print numeric or string values in the tooltip upon hovering as implemented in the code above, I would like to draw in the tooltip a subplot associated with that datapoint . For instance, if the data point I hover over corresponds to the iris dataset Species "versicolor", the subplot should plot something like Petal.Width vs Petal.Length for all data points that also have the species "versicolor".

The following post is related:

Interactive scatter plots in R, overlay/hover summary/tooltip as user supplied plot function

There is an answer from that post that uses packages plotly and shiny together, but I would like to show my plot in the tooltip. Also, I'd prefer to avoid using Plotly, if possible.

0

There are 0 answers