Linked plots without using Shiny

Multi tool use
Multi tool use












6















I have created a shiny app to show a correlation heatmap for a large dataset. When the heatmap tiles are pressed, the corresponding scatterplots are displayed.



However, I need to make several of these apps and this exceeds my limit of publishing on shinyapps.io. My company is unwilling to upgrade to a paying plan. I have tried using alternative methods to publish the app such as RInno, to no avail (I think the app is too complex?).



If someone could please tell me how I could produce the same with plotly alone and NOT with shiny, I would be forever grateful. I believe something like crosstalk might be the path to take in order to link the heat map tiles to the scatter plots?



Thank you



Example from here.



library(plotly)
library(shiny)

# compute a correlation matrix
correlation <- round(cor(mtcars), 3)
nms <- names(mtcars)

ui <- fluidPage(
mainPanel(
plotlyOutput("heat"),
plotlyOutput("scatterplot")
),
verbatimTextOutput("selection")
)

server <- function(input, output, session) {
output$heat <- renderPlotly({
plot_ly(x = nms, y = nms, z = correlation,
key = correlation, type = "heatmap", source = "heatplot") %>%
layout(xaxis = list(title = ""),
yaxis = list(title = ""))
})

output$selection <- renderPrint({
s <- event_data("plotly_click")
if (length(s) == 0) {
"Click on a cell in the heatmap to display a scatterplot"
} else {
cat("You selected: nn")
as.list(s)
}
})

output$scatterplot <- renderPlotly({
s <- event_data("plotly_click", source = "heatplot")
if (length(s)) {
vars <- c(s[["x"]], s[["y"]])
d <- setNames(mtcars[vars], c("x", "y"))
yhat <- fitted(lm(y ~ x, data = d))
plot_ly(d, x = ~x) %>%
add_markers(y = ~y) %>%
add_lines(y = ~yhat) %>%
layout(xaxis = list(title = s[["x"]]),
yaxis = list(title = s[["y"]]),
showlegend = FALSE)
} else {
plotly_empty()
}
})

}

shinyApp(ui, server)


enter image description here










share|improve this question




















  • 1





    I don't really understand what you want to do but couldn't it be solution to put that what you call different apps in multiple tabs? In that way you are still just publishing one app in shinyapp.io!

    – Bertil Baron
    May 14 '18 at 7:39






  • 2





    what about hosting on your own server with the opensource shiny-server then you can host as many apps you want and you have no limited usage hours. Just an Idee. To host a server would be much cheaper than to have you all learning a new technology and you already have quite a nice app in Shiny

    – Bertil Baron
    May 14 '18 at 7:46






  • 1





    to follow BertilBaron idea, you could also rent a server on Amazon Web Services (aws-EC2). It is relatively simple to install the shiny-server.

    – MLavoie
    May 14 '18 at 10:35






  • 1





    You could wrap your app in a docker container and host it via shinyproxy: shinyproxy.io

    – ismirsehregal
    Oct 18 '18 at 20:20








  • 1





    On Windows even easier is running the script as a service: add runApp(host="0.0.0.0", port=80) to your app, configure RScript.exe as target and add your script as an argument via: nssm.cc

    – ismirsehregal
    Oct 18 '18 at 20:46
















6















I have created a shiny app to show a correlation heatmap for a large dataset. When the heatmap tiles are pressed, the corresponding scatterplots are displayed.



However, I need to make several of these apps and this exceeds my limit of publishing on shinyapps.io. My company is unwilling to upgrade to a paying plan. I have tried using alternative methods to publish the app such as RInno, to no avail (I think the app is too complex?).



If someone could please tell me how I could produce the same with plotly alone and NOT with shiny, I would be forever grateful. I believe something like crosstalk might be the path to take in order to link the heat map tiles to the scatter plots?



Thank you



Example from here.



library(plotly)
library(shiny)

# compute a correlation matrix
correlation <- round(cor(mtcars), 3)
nms <- names(mtcars)

ui <- fluidPage(
mainPanel(
plotlyOutput("heat"),
plotlyOutput("scatterplot")
),
verbatimTextOutput("selection")
)

server <- function(input, output, session) {
output$heat <- renderPlotly({
plot_ly(x = nms, y = nms, z = correlation,
key = correlation, type = "heatmap", source = "heatplot") %>%
layout(xaxis = list(title = ""),
yaxis = list(title = ""))
})

output$selection <- renderPrint({
s <- event_data("plotly_click")
if (length(s) == 0) {
"Click on a cell in the heatmap to display a scatterplot"
} else {
cat("You selected: nn")
as.list(s)
}
})

output$scatterplot <- renderPlotly({
s <- event_data("plotly_click", source = "heatplot")
if (length(s)) {
vars <- c(s[["x"]], s[["y"]])
d <- setNames(mtcars[vars], c("x", "y"))
yhat <- fitted(lm(y ~ x, data = d))
plot_ly(d, x = ~x) %>%
add_markers(y = ~y) %>%
add_lines(y = ~yhat) %>%
layout(xaxis = list(title = s[["x"]]),
yaxis = list(title = s[["y"]]),
showlegend = FALSE)
} else {
plotly_empty()
}
})

}

shinyApp(ui, server)


enter image description here










share|improve this question




















  • 1





    I don't really understand what you want to do but couldn't it be solution to put that what you call different apps in multiple tabs? In that way you are still just publishing one app in shinyapp.io!

    – Bertil Baron
    May 14 '18 at 7:39






  • 2





    what about hosting on your own server with the opensource shiny-server then you can host as many apps you want and you have no limited usage hours. Just an Idee. To host a server would be much cheaper than to have you all learning a new technology and you already have quite a nice app in Shiny

    – Bertil Baron
    May 14 '18 at 7:46






  • 1





    to follow BertilBaron idea, you could also rent a server on Amazon Web Services (aws-EC2). It is relatively simple to install the shiny-server.

    – MLavoie
    May 14 '18 at 10:35






  • 1





    You could wrap your app in a docker container and host it via shinyproxy: shinyproxy.io

    – ismirsehregal
    Oct 18 '18 at 20:20








  • 1





    On Windows even easier is running the script as a service: add runApp(host="0.0.0.0", port=80) to your app, configure RScript.exe as target and add your script as an argument via: nssm.cc

    – ismirsehregal
    Oct 18 '18 at 20:46














6












6








6


1






I have created a shiny app to show a correlation heatmap for a large dataset. When the heatmap tiles are pressed, the corresponding scatterplots are displayed.



However, I need to make several of these apps and this exceeds my limit of publishing on shinyapps.io. My company is unwilling to upgrade to a paying plan. I have tried using alternative methods to publish the app such as RInno, to no avail (I think the app is too complex?).



If someone could please tell me how I could produce the same with plotly alone and NOT with shiny, I would be forever grateful. I believe something like crosstalk might be the path to take in order to link the heat map tiles to the scatter plots?



Thank you



Example from here.



library(plotly)
library(shiny)

# compute a correlation matrix
correlation <- round(cor(mtcars), 3)
nms <- names(mtcars)

ui <- fluidPage(
mainPanel(
plotlyOutput("heat"),
plotlyOutput("scatterplot")
),
verbatimTextOutput("selection")
)

server <- function(input, output, session) {
output$heat <- renderPlotly({
plot_ly(x = nms, y = nms, z = correlation,
key = correlation, type = "heatmap", source = "heatplot") %>%
layout(xaxis = list(title = ""),
yaxis = list(title = ""))
})

output$selection <- renderPrint({
s <- event_data("plotly_click")
if (length(s) == 0) {
"Click on a cell in the heatmap to display a scatterplot"
} else {
cat("You selected: nn")
as.list(s)
}
})

output$scatterplot <- renderPlotly({
s <- event_data("plotly_click", source = "heatplot")
if (length(s)) {
vars <- c(s[["x"]], s[["y"]])
d <- setNames(mtcars[vars], c("x", "y"))
yhat <- fitted(lm(y ~ x, data = d))
plot_ly(d, x = ~x) %>%
add_markers(y = ~y) %>%
add_lines(y = ~yhat) %>%
layout(xaxis = list(title = s[["x"]]),
yaxis = list(title = s[["y"]]),
showlegend = FALSE)
} else {
plotly_empty()
}
})

}

shinyApp(ui, server)


enter image description here










share|improve this question
















I have created a shiny app to show a correlation heatmap for a large dataset. When the heatmap tiles are pressed, the corresponding scatterplots are displayed.



However, I need to make several of these apps and this exceeds my limit of publishing on shinyapps.io. My company is unwilling to upgrade to a paying plan. I have tried using alternative methods to publish the app such as RInno, to no avail (I think the app is too complex?).



If someone could please tell me how I could produce the same with plotly alone and NOT with shiny, I would be forever grateful. I believe something like crosstalk might be the path to take in order to link the heat map tiles to the scatter plots?



Thank you



Example from here.



library(plotly)
library(shiny)

# compute a correlation matrix
correlation <- round(cor(mtcars), 3)
nms <- names(mtcars)

ui <- fluidPage(
mainPanel(
plotlyOutput("heat"),
plotlyOutput("scatterplot")
),
verbatimTextOutput("selection")
)

server <- function(input, output, session) {
output$heat <- renderPlotly({
plot_ly(x = nms, y = nms, z = correlation,
key = correlation, type = "heatmap", source = "heatplot") %>%
layout(xaxis = list(title = ""),
yaxis = list(title = ""))
})

output$selection <- renderPrint({
s <- event_data("plotly_click")
if (length(s) == 0) {
"Click on a cell in the heatmap to display a scatterplot"
} else {
cat("You selected: nn")
as.list(s)
}
})

output$scatterplot <- renderPlotly({
s <- event_data("plotly_click", source = "heatplot")
if (length(s)) {
vars <- c(s[["x"]], s[["y"]])
d <- setNames(mtcars[vars], c("x", "y"))
yhat <- fitted(lm(y ~ x, data = d))
plot_ly(d, x = ~x) %>%
add_markers(y = ~y) %>%
add_lines(y = ~yhat) %>%
layout(xaxis = list(title = s[["x"]]),
yaxis = list(title = s[["y"]]),
showlegend = FALSE)
} else {
plotly_empty()
}
})

}

shinyApp(ui, server)


enter image description here







r shiny plotly interactive ggplotly






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 14 '18 at 5:09







J.Con

















asked May 14 '18 at 4:38









J.ConJ.Con

1,85911329




1,85911329








  • 1





    I don't really understand what you want to do but couldn't it be solution to put that what you call different apps in multiple tabs? In that way you are still just publishing one app in shinyapp.io!

    – Bertil Baron
    May 14 '18 at 7:39






  • 2





    what about hosting on your own server with the opensource shiny-server then you can host as many apps you want and you have no limited usage hours. Just an Idee. To host a server would be much cheaper than to have you all learning a new technology and you already have quite a nice app in Shiny

    – Bertil Baron
    May 14 '18 at 7:46






  • 1





    to follow BertilBaron idea, you could also rent a server on Amazon Web Services (aws-EC2). It is relatively simple to install the shiny-server.

    – MLavoie
    May 14 '18 at 10:35






  • 1





    You could wrap your app in a docker container and host it via shinyproxy: shinyproxy.io

    – ismirsehregal
    Oct 18 '18 at 20:20








  • 1





    On Windows even easier is running the script as a service: add runApp(host="0.0.0.0", port=80) to your app, configure RScript.exe as target and add your script as an argument via: nssm.cc

    – ismirsehregal
    Oct 18 '18 at 20:46














  • 1





    I don't really understand what you want to do but couldn't it be solution to put that what you call different apps in multiple tabs? In that way you are still just publishing one app in shinyapp.io!

    – Bertil Baron
    May 14 '18 at 7:39






  • 2





    what about hosting on your own server with the opensource shiny-server then you can host as many apps you want and you have no limited usage hours. Just an Idee. To host a server would be much cheaper than to have you all learning a new technology and you already have quite a nice app in Shiny

    – Bertil Baron
    May 14 '18 at 7:46






  • 1





    to follow BertilBaron idea, you could also rent a server on Amazon Web Services (aws-EC2). It is relatively simple to install the shiny-server.

    – MLavoie
    May 14 '18 at 10:35






  • 1





    You could wrap your app in a docker container and host it via shinyproxy: shinyproxy.io

    – ismirsehregal
    Oct 18 '18 at 20:20








  • 1





    On Windows even easier is running the script as a service: add runApp(host="0.0.0.0", port=80) to your app, configure RScript.exe as target and add your script as an argument via: nssm.cc

    – ismirsehregal
    Oct 18 '18 at 20:46








1




1





I don't really understand what you want to do but couldn't it be solution to put that what you call different apps in multiple tabs? In that way you are still just publishing one app in shinyapp.io!

– Bertil Baron
May 14 '18 at 7:39





I don't really understand what you want to do but couldn't it be solution to put that what you call different apps in multiple tabs? In that way you are still just publishing one app in shinyapp.io!

– Bertil Baron
May 14 '18 at 7:39




2




2





what about hosting on your own server with the opensource shiny-server then you can host as many apps you want and you have no limited usage hours. Just an Idee. To host a server would be much cheaper than to have you all learning a new technology and you already have quite a nice app in Shiny

– Bertil Baron
May 14 '18 at 7:46





what about hosting on your own server with the opensource shiny-server then you can host as many apps you want and you have no limited usage hours. Just an Idee. To host a server would be much cheaper than to have you all learning a new technology and you already have quite a nice app in Shiny

– Bertil Baron
May 14 '18 at 7:46




1




1





to follow BertilBaron idea, you could also rent a server on Amazon Web Services (aws-EC2). It is relatively simple to install the shiny-server.

– MLavoie
May 14 '18 at 10:35





to follow BertilBaron idea, you could also rent a server on Amazon Web Services (aws-EC2). It is relatively simple to install the shiny-server.

– MLavoie
May 14 '18 at 10:35




1




1





You could wrap your app in a docker container and host it via shinyproxy: shinyproxy.io

– ismirsehregal
Oct 18 '18 at 20:20







You could wrap your app in a docker container and host it via shinyproxy: shinyproxy.io

– ismirsehregal
Oct 18 '18 at 20:20






1




1





On Windows even easier is running the script as a service: add runApp(host="0.0.0.0", port=80) to your app, configure RScript.exe as target and add your script as an argument via: nssm.cc

– ismirsehregal
Oct 18 '18 at 20:46





On Windows even easier is running the script as a service: add runApp(host="0.0.0.0", port=80) to your app, configure RScript.exe as target and add your script as an argument via: nssm.cc

– ismirsehregal
Oct 18 '18 at 20:46












1 Answer
1






active

oldest

votes


















0














The best answer would likely be to use crosstalk in conjunction with flexdashboard https://rmarkdown.rstudio.com/flexdashboard/.



A live example of using both be found here: http://rstudio-pubs-static.s3.amazonaws.com/209203_02f14fea3274448bbbf8d04c99c6051b.html.



The end result is just an html page which is easy to share and use. Based on your example you shouldn't need shiny and it you should be able to use crosstalk for this use case. You'd need to step outside of R to get that functionality otherwise. Best of luck!






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50323179%2flinked-plots-without-using-shiny%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The best answer would likely be to use crosstalk in conjunction with flexdashboard https://rmarkdown.rstudio.com/flexdashboard/.



    A live example of using both be found here: http://rstudio-pubs-static.s3.amazonaws.com/209203_02f14fea3274448bbbf8d04c99c6051b.html.



    The end result is just an html page which is easy to share and use. Based on your example you shouldn't need shiny and it you should be able to use crosstalk for this use case. You'd need to step outside of R to get that functionality otherwise. Best of luck!






    share|improve this answer




























      0














      The best answer would likely be to use crosstalk in conjunction with flexdashboard https://rmarkdown.rstudio.com/flexdashboard/.



      A live example of using both be found here: http://rstudio-pubs-static.s3.amazonaws.com/209203_02f14fea3274448bbbf8d04c99c6051b.html.



      The end result is just an html page which is easy to share and use. Based on your example you shouldn't need shiny and it you should be able to use crosstalk for this use case. You'd need to step outside of R to get that functionality otherwise. Best of luck!






      share|improve this answer


























        0












        0








        0







        The best answer would likely be to use crosstalk in conjunction with flexdashboard https://rmarkdown.rstudio.com/flexdashboard/.



        A live example of using both be found here: http://rstudio-pubs-static.s3.amazonaws.com/209203_02f14fea3274448bbbf8d04c99c6051b.html.



        The end result is just an html page which is easy to share and use. Based on your example you shouldn't need shiny and it you should be able to use crosstalk for this use case. You'd need to step outside of R to get that functionality otherwise. Best of luck!






        share|improve this answer













        The best answer would likely be to use crosstalk in conjunction with flexdashboard https://rmarkdown.rstudio.com/flexdashboard/.



        A live example of using both be found here: http://rstudio-pubs-static.s3.amazonaws.com/209203_02f14fea3274448bbbf8d04c99c6051b.html.



        The end result is just an html page which is easy to share and use. Based on your example you shouldn't need shiny and it you should be able to use crosstalk for this use case. You'd need to step outside of R to get that functionality otherwise. Best of luck!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 31 '18 at 20:43









        Bryant Bryant

        32




        32
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50323179%2flinked-plots-without-using-shiny%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Zy rG gK,J41gTo3PjUMWOl1Yr9z8OC7Soi5islh Z W
            vu0tgQ4Rjxtj

            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas