Skip to content
Permalink
Browse files

MAINT: Subset to general partition, add text labels

  • Loading branch information
pan14001 committed Mar 29, 2018
1 parent cf017b1 commit dff14ef59491b3c0b16943879a8556606f40dd5f
Showing with 17 additions and 12 deletions.
  1. +17 −12 plot-top5-core-count.R
@@ -20,18 +20,23 @@ tbl <- read_delim('sacct-week.psv.gz',
day = date(Submit))

cores <- tbl %>%
group_by(day, Partition, User) %>%
filter(Partition == "general") %>%
group_by(day, User) %>%
summarize(ncpus = sum(NCPUS))
top5 <- cores %>% group_by(User) %>%
summarize(ncpus = sum(ncpus)) %>% top_n(5) %>% pull(User)
other <- "other"
cores <- cores %>% mutate(top_user = ifelse(User %in% top5, User, other))
top <- cores %>% group_by(User) %>%
summarize(ncpus = sum(ncpus)) %>% top_n(5) %>%
arrange(-ncpus) %>% pull(User)
other <- "others"
cores <- cores %>%
mutate(top_user = ifelse(User %in% top, User, other)) %>%
## Set the factor order for the plot.
mutate(top_user = factor(top_user,
c(top, other) %>% rev()))

gg_cores <- ggplot(cores,
aes(day, ncpus, fill = factor(top_user,
c(top5, other) %>% rev()))) +
gg_cores <- ggplot(cores, aes(day, ncpus, fill = top_user)) +
geom_bar(position = "stack", stat = "identity") +
## geom_text(aes(label = ifelse(User %in% top5, ncpus, NA))) +
labs(fill = "Top 5 users") +
facet_wrap(~ Partition)
ggsave("tmp.png", width = 10)
geom_text(aes(label = ifelse(User %in% top, ncpus, NA)),
position = "stack", check_overlap = TRUE) +
labs(fill = "Top 5 users")
suppressWarnings( # Yes, label in geom_text has NAs to reduce overplotting.
ggsave("tmp.png", width = 10))

0 comments on commit dff14ef

Please sign in to comment.
You can’t perform that action at this time.