Displaying symbols instead of words in selectInput

Hello again:

I have the following shiny code in which the selections are currently in a word description:

ui <- fluidPage(
selectInput("shape1","Shapes",choices=c("Plus","Star","Diamond")),


plotOutput("plot1")
)

server <- function(input,output,session) {
     output$plot1 <- renderPlot({
  df <- data.frame(x=c(1, 3, 3, 4, 5, 5, 6, 9, 12, 15),
                 y=c(13, 14, 14, 12, 17, 21, 22, 28, 30, 31),xsp=rep(NA,10))

if(input$shape1=="Plus") {
df$xsp <- rep(3,10)

p <- ggplot(df, aes(x=x, y=y)) +
geom_point(aes(x,y),shape=df$xsp)
  }
if(input$shape1=="Star") {
df$xsp <- rep(4,10)
p <- ggplot(df, aes(x=x, y=y)) +
 geom_point(aes(x,y),shape=df$xsp)
  }

if(input$shape1=="Diamond") {
df$xsp <- rep(5,10)
p <- ggplot(df, aes(x=x, y=y)) +
  geom_point(aes(x,y),shape=df$xsp)
  }

p

  })
  }
  

shinyApp(ui,server)

I would like the actual symbol to appear, say shape(3) from ggplot or pch=3, in base R. Is that possible, please?

Thanks,
Erin

This might be of interest:

Here is what I ended up with:

setSymModule <- function(input,output,session) {
output$sym1 <- renderUI({
ns <- session$ns


radioButtons(ns('stuff'),"Plotting Symbols:",	
		choiceNames=list(
                 HTML("<p style='color:red;'>&lowast;</p>"),
                 HTML("<p style='color:red;'>&#9670;</p>")
		 ),
		 choiceValues=list("star","diamond"))
})

reactive(input$stuff)
}

It works perfectly!

thanks,
Erin

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.