Skip to content

Commit 964cc92

Browse files
committed
simplify shiny example
1 parent 1f107c6 commit 964cc92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inst/examples/UN_Advanced/server.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ shinyServer(function(input, output, session) {
2828
theme(legend.direction = "horizontal", legend.position = "bottom")
2929

3030
# Convert ggplot object to plotly
31-
gg <- get_plot(ggplotly(ggideal_point))
31+
gg <- plotly_build(ggideal_point)
3232

3333
# Use Plotly syntax to further edit the plot:
3434
gg$layout$annotations <- NULL # Remove the existing annotations (the legend label)
@@ -37,7 +37,7 @@ shinyServer(function(input, output, session) {
3737
# Add colored text annotations next to the end of each line
3838
# More about plotly annotations: https://plot.ly/r/reference/#annotation
3939
# Each key that we update is documented in that link above.
40-
for(i in 1:(length(gg$data))){ # data is a list of the lines in the graph
40+
for (i in 1:length(gg$data)) { # data is a list of the lines in the graph
4141
gg$layout$annotations[[i]] <- list(
4242
text = gg$data[[i]]$name, # The text label of the annotation, e.g. "Canada"
4343
font = list(color = gg$data[[i]]$line$color), # Match the font color to the line color

0 commit comments

Comments
 (0)