使用下面的代码,我可以在一个闪亮的应用程序中创建所需的线条图。我想把情节转变成一个情节。我尝试了以下代码,但收到以下错误:“ plotlyOutput $ line_60 <-renderPlotly({ “关闭”类型的对象不可子集”。
linedataPlot_60 <- reactive ({
ggplot(linedata_60(),
aes(
x = Year,
y = Percentage,
colour = County
)) + geom_line(size = 2)+ #ylim(0,30)+
geom_point(size = 1,
shape = 21,
fill = "white" ) + #scale_colour_manual(values=cbbPalette) +
geom_text(
aes(label = Percentage2),
colour = "BLACk",
fontface = "bold",
hjust = 0.5,
vjust=-0.6,
size = 3.2
) +
"first.points"),colour="Black") +
colour="Blue")+
labs(
x = "Year",
y = "Percentage",
caption = (""),
face = "bold"
) +
theme_bw() + #scale_y_continuous(breaks=seq(0,40,1)) +
theme(legend.title=element_blank(),legend.text = element_text(face = "bold"), plot.title = element_text(
hjust = 0.5,
size = 14,
colour = "Black",
face = "bold"
),axis.text=(blue.bold.10.text), axis.title=blue.bold.12.text)+
ggtitle(paste(
input$sex_,
"Older Population (60 or over) in the Selected Counties",
# input$county_,
"\n", "\n",
"(2010 to 2050)"
))
})
plotlyOutput$line_60 <- renderPlotly ({
ggplotly (linedataPlot_60())
})