I have a data frame showing the number of patents by category by country.
I want to create a nested doughnut plot showing the proportion of patents per category on the inner plot and then the breakdown of patent classes by country on the outer plot. Alternatively, I want to show the proportion of countries patenting on the inner plot and then the breakdown of patent classes on the outer plot.
I tried webr and it does this but I have little control over formatting. I prefer to do this in ggplot but I am getting my knickers in a serious knot.
I am trying to implement this solution How to create a ggplot2 pie and donut chart on same plot? but I am getting confused by how to split patent class labels.
I have 3073 patents, grouped into 8 patent classes for 119 countries.
My data can be accessed here: data/patents.Rdata at master · aterhorst/data · GitHub
class_breakdown <- lens_data %>% select(class = value, country_code = `Country Code`, country = `Country Name`) %>% mutate(country_code = ifelse(is.na(country), "XX", country_code), country = ifelse(country_code == "XX", "Unknown", country)) %>% group_by(class, country) %>% summarise(patents = sum(n()))
Can someone help me here, please?