Created
April 12, 2020 03:52
-
-
Save kohske/15553bdfc5e15f3d45f4ae8f03b5b98c to your computer and use it in GitHub Desktop.
ggjap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is a Shiny web application. You can run the application by clicking | |
# the 'Run App' button above. | |
# | |
# Find out more about building applications with Shiny here: | |
# | |
# http://shiny.rstudio.com/ | |
# | |
library(shiny) | |
library(ggplot2) | |
library(curl) | |
# fontの導入 | |
library(showtext) | |
font_add_google("Noto Sans JP", "NSJP") | |
showtext_auto() | |
# Define UI for application that draws a histogram | |
ui <- fluidPage( | |
fluidPage( | |
selectInput("sel",label = "col",choices = colnames(iris)[2:4]), | |
selectInput("color",label = "col",choices = c("red", "black", "blue", "green")), | |
plotOutput("plot") | |
) | |
) | |
# Define server logic required to draw a histogram | |
server <- function(input, output) { | |
output$plot = renderPlot({ | |
data = data.frame(x = iris[,input$sel], y = iris$Sepal.Length) | |
g = ggplot(data, aes(x = x, y = y)) | |
g = g + geom_point(colour=input$color) | |
g = g + labs(x="何らかのパラメータ") | |
g = g + theme_bw(base_family="NSJP") # 修正 | |
print(g) | |
}) | |
} | |
# Run the application | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment