You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make a single chart that has both a bar chart and a relevant pie using subplot(). Subplot is optimal because I'd like the users to be able to screenshot both charts at once. Here is the code:
library(dplyr)
library(plotly)
bar_info <- data.frame(
Group = rep(c("first", "second", "third"), 2),
values_monthly = c(100, 200, 300, 400, 500, 600),
month = rep(c("April", "May"), each = 3) %>% as.factor()
)
pie_info <- group_by(bar_info, Group) %>%
summarise(values_total = sum(values_monthly))
colors = c("red", "blue", "yellow")
bar_chart <- plot_ly(bar_info, type = "bar",
x = ~ month, y = ~ values_monthly, color = ~Group,
colors = colors)
pie_chart <- plot_ly(pie_info, type = "pie",
labels = ~Group, values = ~values_total,
marker = list(colors = colors),
# setting up pie to the right
domain = list(x = c(0.9, 1), y = c(0,1)),
showlegend = F
)
combined_chart <- subplot(bar_chart, pie_chart, nrows = 1,
widths = c(0.9, 0.1))
combined_chart
Now, the most important thing, the chart looks as it should.
However, it displays these warnings:
How can I get rid of them? I've tried using shareX and shareY set to F or using add_trace for the pie, no help.
When I open the JSON with plotly_json(combined_chart), I can see that the layout object has a new, unneeded object NA2. This is probably related to the problem.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to make a single chart that has both a bar chart and a relevant pie using subplot(). Subplot is optimal because I'd like the users to be able to screenshot both charts at once. Here is the code:
Now, the most important thing, the chart looks as it should.
However, it displays these warnings:
How can I get rid of them? I've tried using shareX and shareY set to F or using add_trace for the pie, no help.
When I open the JSON with
plotly_json(combined_chart)
, I can see that the layout object has a new, unneeded object NA2. This is probably related to the problem.The text was updated successfully, but these errors were encountered: