Попробуйте этот справочный инструмент сообщения об ошибках PHP . Это очень хорошая визуальная ссылка и помогла мне понять механизм создания сложных ошибок.
Существует ggiraph
( https://davidgohel.github.io/ggiraph/articles/offcran/using_ggiraph.html ), но так как я не знаю, что вы хотите показать, когда наведите курсор мыши, Я могу предоставить только неполную версию:
myChart <- ggplot(sales_data, aes(x = month, y = dept_name)) +
geom_raster(data = expand.grid(sales_data$month, sales_data$dept_name),
aes(x = Var1, y = Var2, width=1, height=1), fill = NA, col = 'gray50', lty = 1) + #default width and height is 1
geom_point_interactive(aes(tooltip = status, data_id = status, colour = cut(revenue, c(-Inf, 199, 301, Inf)) ),
shape = 16, position = position_jitter(seed = 0), show.legend = F) +
scale_color_manual(name = "revenue",
values = c("(-Inf,199]" = "red",
"(199,301]" = "#ffbf00", #amber
"(301, Inf]" = "green") ) +
geom_text(aes(label = revenue), size=4, vjust = 1.6, position = position_jitter(seed = 0)) + #try with geom_text
theme_bw() +
theme(
axis.title = element_blank(),
axis.ticks = element_blank(),
plot.background = element_blank(),
axis.line = element_blank(),
panel.border = element_blank(),
panel.grid = element_blank(),
axis.text = element_text(colour = "blue", face = "plain", size =11)
) +
scale_x_continuous(limits=c(0.5,3.5), expand = c(0,0), breaks = 1:length(month_vector), labels = month_vector) +
scale_y_discrete(expand = c(0,0)) +
geom_hline(yintercept = as.numeric(sales_data$dept_name) + 0.5) +
geom_vline(xintercept = as.numeric(sales_data$month) - 0.5, color = "grey")
library(ggiraph)
ggiraph(myChart2)
girafe(code = print(myChart) )