问题
I want to use the output of ggtern()
in a shiny app. However it seems to fail due to some constraints.
This is what it should look like:
This is the actual shiny output:
See here for a reproducible example:
library(shiny)
library(ggtern)
ui <- fluidPage(
mainPanel(
plotOutput("ggtern")
)
)
server <- function(input, output) {
output$ggtern <- renderPlot({
ggtern(data.frame(x=10, y=30, z=60), aes(x, y, z)) + geom_point()
})
}
shinyApp(ui = ui, server = server)
Do I overlook something?
回答1:
place the plot function within a print
command:
output$ggtern <- renderPlot({
print(ggtern(data.frame(x=10, y=30, z=60), aes(x, y, z)) + geom_point())
})
来源:https://stackoverflow.com/questions/55101305/ternary-plot-of-ggtern-not-working-in-shiny