• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版878ca162b805294e9f2a4787be8d4d79d5abfdfb (tree)
时间2022-04-01 21:46:26
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

A self contained example about how to use latex in shiny + plotly.

更改概述

差异

diff -r 5bdac9f5ed63 -r 878ca162b805 R-codes/test_shiny_latex_plotly.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/R-codes/test_shiny_latex_plotly.R Fri Apr 01 14:46:26 2022 +0200
@@ -0,0 +1,34 @@
1+library(shiny)
2+library(plotly)
3+library(tidyverse)
4+
5+set.seed(1234)
6+
7+x <- runif(2000)
8+
9+df_frag_norm <- tibble(n1_norm = x)
10+
11+ui <- fluidPage(
12+ withMathJax(),
13+ plotlyOutput("myplot1")
14+)
15+
16+server <- function(input, output) {
17+ output$myplot1 <- renderPlotly({
18+ fig <- plot_ly(
19+ df_frag_norm,
20+ x = ~ n1_norm,
21+ ## y = ~decessi_giornalieri,
22+ type = 'histogram',
23+ xbins = list(size = 0.05)
24+ ) %>%
25+ layout(bargap = 0.1,
26+ xaxis = list(
27+ range = c(0, 1),
28+ title = TeX("n_1/(n_1+n_2)")
29+ ))
30+ })
31+
32+}
33+
34+shinyApp(ui, server)