I'm trying publish a Shiny visual in an .rmd file. My code runs, but the output leaflet is compressed when I run the .rmd file. Any insights on how to make this "taller"?
ui1 <- fluidPage(
titlePanel("Temperature per year by State"),
sidebarLayout(
sidebarPanel(
inputPanel(
selectInput(inputId = "input_year",
label = "Which Year do you want to display?",
choices = years,
selected = years))),
mainPanel(
plotOutput("plot1")
)))
grouping <-
server1 <- function(input, output){
output$plot1 <- renderPlot({
ggplot(filter(dataset_new,
Year == input$input_year),
mapping = aes(x = long, y = lat, group = group, fill = Average.temp))+
geom_polygon(color = "black")+
guides(fill = guide_legend(title = "Temperature\n(F)",
reverse = T))+
labs(x = "Longitude",y = "Latitude",
title = "Average temperature by U.S. State")+
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"))+
annotate("text", x = -115, y = 27, label = "***Temperature information for\nNevada, New Mexico and\n Oklahoma was not available") +
scale_fill_gradient(low = "yellow", high = "red")
})}
shinyApp(ui = ui1, server = server1)