Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204742

My ggplot visulisation in my shiny app wont show the points

$
0
0

Hi I'm trying to create a simple shiny dashboard which filters the point chart based on different sites

Site      AssetID Category   N

Site1      A       Cat1     3

Site1   B       Cat1     5

Site1   A       Cat2     6

Site2   B       Cat3     10

Site2   B       Cat1     2

Site2   A       Cat1     5

Site3   A       Cat2     5

That is the simple data frame. The App you select which site you want to view and the plot is shown. Below is the code

library(shiny)
ui <- fluidPage(
    titlePanel("Outage Summary"),
    sidebarLayout(
        sidebarPanel(
           # sliderInput("priceInput", "Price", 0, 100, c(25, 40), pre = "$"),
            #radioButtons("typeInput", "Product type",
             #            choices = c("BEER", "REFRESHMENT", "SPIRITS", "WINE"),
              #           selected = "WINE"),
            selectInput("SiteInput", "Site",
                        choices = site_turbine$Site)
        ),
        mainPanel(
            plotOutput("coolplot")
        )
    )
)

server <- function(input, output) {
    output$coolplot <- renderPlot({
        filtered <-
           main_dataframe %>% filter(type2 == "Unplanned") %>%
            filter(Unavailable.generation.units > 0) %>% 
            group_by(Site, AssetID, Category) %>%
            summarise(n = n()) %>%
           filter(Site == "SiteInput"

            )
        ggplot(filtered) +
            geom_point(mapping = aes(x = AssetID, y = Category, size = n, col = n))
    })
}
shinyApp(ui = ui, server = server)

for some reason in the output I just get a blank plot

enter image description here

Any ideas would be greatly appreciated


Viewing all articles
Browse latest Browse all 204742

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>