## Only run examples in interactive R sessions
if (interactive()) {
library(ggplot2)
d <- data.frame(x = rnorm(500))
g <- ggplot(d, aes(x)) + theme_lcars_dark()
g1 <- g + geom_histogram(color = "black", fill = "#9999FF", bins = 20) +
ggtitle("Plot 1")
left <- div(h4("Some text"), p("The fine print."))
ui <- lcarsPage(
lcarsHeader("LCARS sweep"),
h4("Change colors and relative widths of content sections"),
h4("Add title and subtitle, input column padding, and content"),
lcarsSweep(
inputColumn(
lcarsButton("x1", "Button"),
lcarsRect(color = "hopbush", height = 80)
),
left, plotOutput("plot1", height = 650), # plot taller than sweep box
title = "Title", subtitle = "Subtitle",
color = "pale-canary", left_width = 0.3, width = 900,
expand = c(0, 350) # negative bottom margin added to right side div
),
lcarsSweep( # content from sweep box above extends into sweep box below
inputColumn(
lcarsButton("x2", "Button A"),
lcarsButton("x3", "Button B"),
lcarsRect(color = "lilac")
),
left, title = "Title 2", subtitle = "Subtitle 2",
color = "anakiwa", reverse = TRUE, left_width = 0.3, width = 900
)
)
server <- function(input, output) {
output$plot1 <- renderPlot(g1)
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab