Skip to content
Snippets Groups Projects
Commit c5025c21 authored by Jeremie Sibille's avatar Jeremie Sibille :speech_balloon:
Browse files

aes non dynamique

parent a998da9a
No related branches found
No related tags found
No related merge requests found
Pipeline #60550 passed
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
# #
library(shiny) library(shiny)
library(dplyr)
library(ggplot2)
library(DT)
View(diamonds)
# diamonds <- read.csv("data/diamonds.csv")
# Define UI for application that draws a histogram # Define UI for application that draws a histogram
ui <- fluidPage( ui <- fluidPage(
...@@ -18,32 +24,60 @@ ui <- fluidPage( ...@@ -18,32 +24,60 @@ ui <- fluidPage(
# Sidebar with a slider input for number of bins # Sidebar with a slider input for number of bins
sidebarLayout( sidebarLayout(
sidebarPanel( sidebarPanel(
sliderInput("bins", sliderInput("Price",
"Number of bins:", "Prix des diamants:",
min = 1, min = 300,
max = 50, max = 20000,
value = 30) value = 3000),
selectInput(
inputId = "colorFilter",
choices = c("D","E","F","G","H","I","J"),
label = "Choix des couleurs à filtrer",
selected = NULL,
multiple = FALSE,
selectize = TRUE,
width = NULL,
size = NULL
), ),
radioButtons(
inputId = "rosePoint",
label = "Colorier les points en Rose ?",
selected = NULL,
choices = c("oui" = "pink","non"="black"),
),
),
# Show a plot of the generated distribution # Show a plot of the generated distribution
mainPanel( mainPanel(
plotOutput("distPlot") plotOutput("diamondPlot"),
) textOutput("txt")
) )
),
DTOutput(outputId = "DiamondTable")
) )
# Define server logic required to draw a histogram # Define server logic required to draw a histogram
server <- function(input, output) { server <- function(input, output) {
output$distPlot <- renderPlot({ output$diamondPlot <- renderPlot({
# generate bins based on input$bins from ui.R diamonds %>%
x <- faithful[, 2] filter(price > input$Price) %>%
bins <- seq(min(x), max(x), length.out = input$bins + 1) filter(color > input$colorFilter) %>%
ggplot(aes(x= carat,y= price)) +
(aes(color = input$rosePoint))+
geom_point()
# draw the histogram with the specified number of bins })
hist(x, breaks = bins, col = 'darkgray', border = 'white', output$DaimondTable <- renderDT({
xlab = 'Waiting time to next eruption (in mins)', diamonds %>%
main = 'Histogram of waiting times') filter(price > input$Price) %>%
filter(color > input$colorFilter)
})
output$txt <- renderText({
paste("You chose", input$rosePoint)
}) })
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment