Skip to content

Instantly share code, notes, and snippets.

@karthik
Created September 13, 2017 05:31
Show Gist options
  • Save karthik/6b119993dff4ec0bb1fca3aeb64d8967 to your computer and use it in GitHub Desktop.
Save karthik/6b119993dff4ec0bb1fca3aeb64d8967 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(dplyr)
df <-
acuna[grepl("cited_by", names(acuna))] %>% unlist %>% data.frame %>% tibble::rownames_to_column()
names(df) <- c("Provider", "Hits")
df <- df %>% mutate(Provider = gsub("cited_by_", "", Provider))
tmp <- tempfile()
curl::curl_download(acuna$images.small, destfile = tmp)
donut <- readPNG(tmp)
ggplot(df, aes(Provider, Hits)) + geom_point() + annotation_raster(
donut,
xmin = dim(df)[1] - 1,
xmax = dim(df)[1],
ymin = max(df$Hits) - (.2 * max(df$Hits)),
ymax = max(df$Hits),
interpolate = T
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment