R: Adjusting Titles In HTML Files
I am working with the R programming language. I am trying to save multiple HTML files together like this: library(plotly) library(shiny) #create widget_1 widget_1 = plot_ly(iris
Solution 1:
library(htmltools)
library(plotly)
#create widget_1
widget_1 = plot_ly(iris, x = ~Sepal.Length, type = "histogram", nbinsx = 20)
#create_widget_2
widget_2 = plot_ly(iris, x = ~Sepal.Width, type = "histogram", nbinsx = 20)
#create_widget_3
widget_3 = plot_ly(iris, x = ~Petal.Length, type = "histogram", nbinsx = 20)
#create widget_4
widget_4 = plot_ly(iris, x = ~Petal.Width, type = "histogram", nbinsx = 20)
doc <- tagList(
tags$h3(style = "text-align: center;", "Main title"),
div(
style = "display: flex; justify-content: space-between;",
div(
style = "display: flex; flex-direction: column; align-items: center; width: 45%",
widget_1,
tags$p("title 1")
),
div(
style = "display: flex; flex-direction: column; align-items: center; width: 45%",
widget_2,
tags$p("title 2")
)
),
div(style = "height: 50px;"),
div(
style = "display: flex; justify-content: space-between;",
div(
style = "display: flex; flex-direction: column; align-items: center; width: 45%",
widget_3,
tags$p("title 3")
),
div(
style = "display: flex; flex-direction: column; align-items: center; width: 45%",
widget_4,
tags$p("title 4")
)
)
)
browsable(doc)
Post a Comment for "R: Adjusting Titles In HTML Files"