Skip to content

Instantly share code, notes, and snippets.

@kohske
Created April 12, 2020 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohske/15553bdfc5e15f3d45f4ae8f03b5b98c to your computer and use it in GitHub Desktop.
Save kohske/15553bdfc5e15f3d45f4ae8f03b5b98c to your computer and use it in GitHub Desktop.
ggjap
#
# 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