/ code / figures / fig5.R
fig5.R
 1  library(tidyverse)
 2  library(ggridges)
 3  theme_set(theme_light())
 4  
 5  ranks_combined <- read_tsv("analysis/combined/ranks.tsv")
 6  
 7  ranks_summary <- ranks_combined %>%
 8    filter(!is.na(rank)) %>%
 9    mutate(mae = pmin(mae, 30)) %>%
10    summarize(mae=mean(mae), rank=median(rank), .by=Feature_name) %>%
11    arrange(rank)
12  
13  fig5 <- ranks_summary %>%
14    separate(Feature_name, into=c("wavelet", "feature_class", "feature"), sep="_") %>%
15      ggplot(aes(x = rank, y = feature_class, fill = feature_class)) +
16      geom_density_ridges(
17        jittered_points = TRUE,
18        position = position_points_jitter(width = 0.05, height = 0),
19        point_shape = "|", point_size = 3, point_alpha = 1, alpha = 0.7,
20        scale = 0.7
21      ) +
22      xlab("Rank of Features") +
23      ylab("Feature Class") +
24      labs(fill = "Feature Class") +
25      theme(text = element_text(size = 14), legend.position = "none") +
26      scale_fill_brewer(palette = "Set2")
27  
28  ggsave("figures/fig5.svg", plot=fig5, width=10, height=8)