Last active
October 24, 2019 11:58
-
-
Save h4k1m0u/20577e774553b6dec76638c8a66fcf06 to your computer and use it in GitHub Desktop.
Different color for samples (50%) below or above median
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1000 samples from standard normal dist | |
x = seq(1, 1000) | |
y = rnorm(1000) | |
y_normalized = (y - min(y)) / (max(y) - min(y)) | |
# split in half and with different color | |
median = median(y_normalized) | |
print(median) | |
plot(x, y_normalized, pch=21, bg=ifelse(y_normalized > median, 'red', 'green')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment