-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplotlog.R
28 lines (24 loc) · 1.22 KB
/
plotlog.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(tidyverse)
dat <- read_csv('/nfs/public-data/cyberhelp/usage_logs/active_users.csv')
# Plot RStudio active sessions and Slurm active nodes by day, excluding weekends.
p <- dat %>%
mutate(weekend = if_else(weekdays(date) %in% c('Saturday', 'Sunday'), 'weekend', 'weekday')) %>%
select(date, weekend, rstudio_users, slurm_active) %>%
pivot_longer(-c(date, weekend)) %>%
ggplot(aes(x = date, y = value)) +
geom_line() +
geom_point(aes(color = weekend), size = 3) +
coord_cartesian(ylim=c(0, 25)) +
scale_color_manual(values = c('black', 'gray75')) +
facet_wrap(~ name, nrow = 2, labeller = labeller(name = c(rstudio_users = 'Number of active RStudio sessions',
slurm_active = 'Number of active Slurm nodes')),
scales = 'free_y') +
theme_bw() +
theme(strip.background = element_blank(),
legend.position = c(.1, .35),
legend.title = element_blank(),
legend.key = element_blank(),
legend.background = element_blank(),
axis.title.y = element_blank()) +
ggtitle('RStudio and Slurm usage report', format(Sys.time(), '%B %d, %Y'))
ggsave('/nfs/public-data/cyberhelp/usage_logs/usage_report.pdf', p, height = 5, width = 8)