I am currently working on an Shiny app with the amazing package svgPanZoom and I have two questions which remain unsolved for me:
(1) is it possible to customize the size of the graph dynamically. I tried to do that following the code (as in https://stackoverflow.com/questions/33522860/svgplot-error-in-shiny):
library(shiny)
library(svglite)
library(svgPanZoom)
library(ggplot2)
library(plyr)
data.df <- data.frame(Plant = c("Plant1", "Plant1", "Plant1", "Plant2", "Plant2",
"Plant2"), Type = c(1, 2, 3, 1, 2, 3), Axis1 = c(0.2, -0.4, 0.8, -0.2, -0.7,
0.1), Axis2 = c(0.5, 0.3, -0.1, -0.3, -0.1, -0.8))
ui <- shinyUI(bootstrapPage(
svgPanZoomOutput(outputId = "main_plot")
))
server = shinyServer(function(input, output) {
output$main_plot <- renderSvgPanZoom({
p <- ggplot(data.df, aes(x = Axis1, y = Axis2, shape = Plant, color = Type)) + geom_point(size = 5)
svgPanZoom(p, controlIconsEnabled = T, width = 10, height = 16)
})
})
runApp(list(ui=ui,server=server))
but nothing happened :( Do you have an idea ?
(2) Do you know if it could be possible to include a locator in this code (as in PlotOutput)
The main idea is to plot a picture (of cells) in an orthonormed system and that user clicks on the picture to locate the nucleus of the cells. Sometimes the cells are very small on the picture so the user may need to zoom (that's why I use svgPanZoom). Thus, the X and Y that I would like to get are those in the whole orthonormed system even if the user uses the zoom
I had a look at Cursor location after zoom using svg-pan-zoom but it seems not to be from R
Thank you very much for your ideas !
Have a nice sunday evening !
Cha