My RShinylive Demo with R sunspot.month Data

#| standalone: true
#| viewerHeight: 600
library(shiny)
library(bslib)

sunspots_df <- data.frame(count = as.matrix(sunspot.month),
                          date = floor(time(sunspot.month)))

# Define UI for app that draws a histogram ----
ui <- page_sidebar(
  sidebar = sidebar(open = "open",
                    selectInput("year_of_data",
                                label = "Choose Year to Display",
                                choices = list(1749,
                                               1849,
                                               1949),
                                selected = 1749),
                    radioButtons("change_plot",
                                 label = "Visualize",
                                 choices = c("point", "bar"),
                                 selected = "point"
        )
  ),
  plotOutput("plot", width=1100)
)

server <- function(input, output, session) {
  # data <- reactive({
  #   tmp <- beaver_data[[input$dataframe_column]]
  #   return(tmp)
  # })
  # 
  output$plot <- renderPlot({
    if(input$change_plot %in% "point"){
    plot(sunspots_df[sunspots_df$date == input$year_of_data, "count"],
         ylab = "Count",
         xlab = "Month",
         main = paste0("Sunspots of ", input$year_of_data ),
         ylim = c(40,200),
         xlim = c(1,12),
         xaxt = "n",
         pch = 8)
    axis(1, at = c(1:12), cex.axis = 1)
    } else {
       barplot(sunspots_df[sunspots_df$date == input$year_of_data, "count"],
               names = 1:12,
               xlab = "Month")#,
         # names = 1:12,
         # ylab = "Count",
         # xlab = "Month",
         # main = paste0("Sunspots of ", input$year_of_data ),
         # ylim = c(40,200),
         # xlim = c(1,12))
      #axis(1, at = c(1:12), cex.axis = 1)
    }
   # hist(sunspots_df[sunspots_df$date == input$year_of_data,"count"])
   
  }, res=140)
}

# Create Shiny app ----
shinyApp(ui = ui, server = server)