I am trying to create a graph showing the number of citations that papers from a department have received. I want it to be an interactive plot so more information is displayed when hovering a particular entry.
The papers with few citations are suppressed in the ggplotly version, but I would like them so still be shown as in the ggplot.
This is the code I am using:
library(tidyverse)
library(plotly)
download.file("https://raw.githubusercontent.com/luizaandrade/dec-bibliometrics-dashboard/main/citations.rds",
"data.rds",
method = "curl")
data <- readRDS("data.rds")
graph <-
data %>%
ggplot() +
geom_segment(
aes(x = year_scholar,
xend = year_scholar,
y = start,
yend = end,
color = year_id,
text = paste0(title, "<br>",
all_authors, "<br>",
journal, "<br>",
"Citations: ", cites)),
size = 10,
lineend = "butt")
ggplotly(graph,
tooltip = "text")
The ggplot looks like this:
And the plotly version looks like this:
Any suggestions?