Skip to content

Instantly share code, notes, and snippets.

@s4553711
Last active July 9, 2019 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s4553711/2253a94c65d1a4cf810a8b33ff27a9ff to your computer and use it in GitHub Desktop.
Save s4553711/2253a94c65d1a4cf810a8b33ff27a9ff to your computer and use it in GitHub Desktop.
library(ggplot2)
library(scales)
library(ggpubr)
k = read.csv('iostat.tsv')
k$datetime <- as.POSIXct(k$time, origin="1970-01-01", tz="GMT")
s1 <- ggplot(k, aes(datetime)) +
geom_line(aes(y = rs, colour="rs"), alpha=0.4, size=1) +
geom_line(aes(y = ws, colour="ws"), alpha=0.4, size=1) +
scale_color_manual(values = c("rs" = "#F8766D", "ws" = "#00BFC4"), labels = c("rs" = "rs", "ws" = "ws")) +
labs(title = "iostat read/write iops") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_datetime(
labels = date_format("%Y-%m-%d %H:%M:%S"),
# breaks = date_breaks("3 hour"),
# minor_breaks = date_breaks("1 hour")
# limits = c(as.POSIXct("2019-06-07 20:00:00 GMT"), as.POSIXct("2019-06-07 21:00:00 GMT"))
# limits = c(as.POSIXct("2019-07-07 00:00:00 GMT"), as.POSIXct("2019-07-07 18:00:00 GMT"))
)
s2 <- ggplot(k, aes(datetime)) +
geom_line(aes(y = rMB, colour = "rMB"), alpha=0.4) +
geom_line(aes(y = wMB, colour = "wMB"), alpha=0.4) +
scale_color_manual(values = c("rMB" = "#F8766D", "wMB" = "#00BFC4")) +
labs(title = "iostat read/write throughput") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_datetime(
labels = date_format("%Y-%m-%d %H:%M:%S"),
# breaks = date_breaks("3 hour"),
# minor_breaks = date_breaks("1 hour")
# limits = c(as.POSIXct("2019-07-07 00:00:00 GMT"), as.POSIXct("2019-07-07 18:00:00 GMT"))
)
ggarrange(s1, s2, labels = c("A", "B"), ncol = 1, nrow = 2)
ggsave('HG006_R3_work_test.png', width = 10, height = 4, dpi = 150, units = "in")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment