私は現在、すばらしいパッケージ svgPanZoom を使用して Shiny アプリに取り組んでおり、未解決のままの 2 つの質問があります。
(1)グラフのサイズを動的にカスタマイズすることは可能ですか。私はコードに従ってそれをやろうとしました( 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))
しかし、何も起こりませんでした:( アイデアはありますか?
(2)このコードに (PlotOutput のように) ロケーターを含めることができるかどうか知っていますか?
主なアイデアは、直交座標系で (細胞の) 画像をプロットし、その画像をクリックして細胞の核を見つけることです。画像上のセルが非常に小さいため、ユーザーがズームする必要がある場合があります (そのため、私は svgPanZoom を使用しています)。したがって、取得したい X と Y は、ユーザーがズームを使用しても、正規直交システム全体のものです。
svg-pan-zoom を使用してズーム後にカーソルの位置を確認しましたが、R からのものではないようです
アイデアをありがとうございました!
素敵な日曜日の夜を!
チャ