Browse code

changed x label in plot1 and plot2 for selected method

pablo-rodr-bio2 authored on 28/04/2021 07:59:37
Showing 1 changed files
... ...
@@ -10,9 +10,14 @@ plot1_Server <- function(id, rv){
10 10
       
11 11
       output$plot <- renderPlotly({
12 12
         req(rv$dat.t)
13
+        # in order to print the name of the method (and not the 
14
+        # selected value from the method) on the 'x' label, this
15
+        # name is retrieved from the list 'methodChoices' declared
16
+        # in 'global.R
17
+        method <- names(methodChoices)[methodChoices == rv$method]
13 18
         rv$p <- ggplot(data = rv$dat.t, aes(x=value, color=Sample)) +
14 19
           stat_density(geom="line", position = "identity") +
15
-          theme(legend.position = "none") + labs(x="GSVA Scores", y="Density") +
20
+          theme(legend.position = "none") + labs(x=paste0(method, " Scores"), y="Density") +
16 21
           scale_color_manual("Legend", values = rv$dd.col)
17 22
         ggplotly(rv$p, tooltip = "Sample", source = "click1")
18 23
       })
Browse code

modules in shinyApp

pablo-rodr-bio2 authored on 12/04/2021 19:41:34
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,21 @@
1
+plot1_UI <- function(id){
2
+  ns <- NS(id)
3
+  plotlyOutput(ns("plot"))
4
+}
5
+
6
+plot1_Server <- function(id, rv){
7
+  moduleServer(
8
+    id,
9
+    function(input, output, session){
10
+      
11
+      output$plot <- renderPlotly({
12
+        req(rv$dat.t)
13
+        rv$p <- ggplot(data = rv$dat.t, aes(x=value, color=Sample)) +
14
+          stat_density(geom="line", position = "identity") +
15
+          theme(legend.position = "none") + labs(x="GSVA Scores", y="Density") +
16
+          scale_color_manual("Legend", values = rv$dd.col)
17
+        ggplotly(rv$p, tooltip = "Sample", source = "click1")
18
+      })
19
+    }
20
+  )
21
+}
0 22
\ No newline at end of file