You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
591 B
Python
20 lines
591 B
Python
6 years ago
|
from matplotlib import pyplot as plt
|
||
|
|
||
|
friends = [70, 65, 72, 63, 71, 64, 60, 64, 67, ]
|
||
|
minutes = [175, 170, 205, 120, 220, 130, 105, 145, 190]
|
||
|
labels = [l for l in 'abcdefghi']
|
||
|
|
||
|
plt.scatter(friends, minutes)
|
||
|
|
||
|
for label, friend_count, minute_count in zip(labels, friends, minutes):
|
||
|
plt.annotate(label,
|
||
|
xy=(friend_count, minute_count),
|
||
|
xytext=(5, -5),
|
||
|
textcoords='offset points')
|
||
|
|
||
|
plt.title("Daily Minutes vs. Number of Friends")
|
||
|
plt.xlabel("X of friends")
|
||
|
plt.ylabel("Daily minutes spent on site")
|
||
|
plt.axis([58, 74, 80, 240])
|
||
|
plt.show()
|