nbody: mark the points with bad std

This commit is contained in:
Rodrigo Arias 2020-11-05 19:43:39 +01:00
parent d7be13f88d
commit 5bd042ef67

View File

@ -26,7 +26,13 @@ df$blocksPerCpuFactor = as.factor(df$blocksPerCpu)
# Normalize the time by the median # Normalize the time by the median
D=group_by(df, nblocks) %>% D=group_by(df, nblocks) %>%
mutate(tnorm = time / median(time) - 1) mutate(tnorm = time / median(time) - 1) %>%
mutate(bad = max(ifelse(abs(tnorm) >= 0.01, 1, 0)))
D$bad = as.factor(D$bad)
#D$bad = as.factor(ifelse(abs(D$tnorm) >= 0.01, 2,
# ifelse(abs(D$tnorm) >= 0.005, 1, 0)))
bs_unique = unique(df$nblocks) bs_unique = unique(df$nblocks)
nbs=length(bs_unique) nbs=length(bs_unique)
@ -42,13 +48,14 @@ png("box.png", width=w*ppi, height=h*ppi, res=ppi)
# #
# #
# Create the plot with the normalized time vs nblocks # Create the plot with the normalized time vs nblocks
p = ggplot(data=D, aes(x=blocksPerCpuFactor, y=tnorm)) + p = ggplot(data=D, aes(x=blocksPerCpuFactor, y=tnorm, color=bad)) +
# Labels # Labels
labs(x="Num blocks", y="Normalized time", labs(x="Num blocks", y="Normalized time",
title=sprintf("Nbody normalized time. Particles=%d", particles), title=sprintf("Nbody normalized time. Particles=%d", particles),
subtitle=input_file) + subtitle=input_file) +
# Center the title # Center the title
#theme(plot.title = element_text(hjust = 0.5)) + #theme(plot.title = element_text(hjust = 0.5)) +
@ -57,18 +64,19 @@ p = ggplot(data=D, aes(x=blocksPerCpuFactor, y=tnorm)) +
# Add the maximum allowed error lines # Add the maximum allowed error lines
geom_hline(yintercept=c(-0.01, 0.01), geom_hline(yintercept=c(-0.01, 0.01),
linetype="dashed", color="red") + linetype="dashed", color="gray") +
# Draw boxplots # Draw boxplots
geom_boxplot() + geom_boxplot() +
scale_color_manual(values=c("black", "brown")) +
#scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) + #scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) +
theme_bw() + theme_bw() +
theme(plot.subtitle=element_text(size=8)) + theme(plot.subtitle=element_text(size=8)) +
theme(legend.position = "none")
theme(legend.position = c(0.85, 0.85)) #+ #theme(legend.position = c(0.85, 0.85))