Created
May 17, 2019 01:07
-
-
Save jamespeterschinner/1b101f8ab212cc1c25a353738f5925c8 to your computer and use it in GitHub Desktop.
This file contains 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
import matplotlib.pyplot as plt | |
from statistics import mean | |
def chunks(l, n=2): | |
"""Yield successive n-sized chunks from l.""" | |
for i in range(0, len(l), n): | |
yield l[i:i + n] | |
# Data to plot | |
result = [63, 1, 69, 29, 48, 56, 64, 16, 19, 51] | |
temperature = [4, 25, 37, 55, 70] | |
# Calculate mean of 2 samples | |
data = { | |
str(temp): mean(result) | |
for temp, result in zip(temperature, chunks(result)) | |
} | |
plt.bar(data.keys(), data.values()) | |
plt.show() |
Author
jamespeterschinner
commented
May 17, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment