Skip to content

Commit d8c8947

Browse files
committedJun 7, 2021
Specify boxmode to fix grouped boxplots
Filled boxplots did not have position = dodge in plotly - instead, all boxes appear on top of each other. This can be fixed by setting the layout of boxmode to group, but it also produces a number of warnings. These warnings can apparently be ignored, but I haven't found a good way to do that yet. (suppressWarnings seems dangerous, and expect_warning makes the test code cluttered.) Info about this warning: plotly/plotly.R#1644 https://community.plotly.com/t/not-a-real-error-for-boxmode/2596
1 parent d2e9a7d commit d8c8947

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎R/mod_plot.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ mod_plot_server <- function(id, dataset, selections){
4646
})
4747

4848
output$plot <- renderPlotly({
49-
ggplotly(plot_obj())
49+
req(plot_obj)
50+
plot_obj() %>% ggplotly() %>% plotly::layout(boxmode = 'group')
5051
})
5152
})
5253
}

0 commit comments

Comments
 (0)
Please sign in to comment.