Added a seaborn line chart example

master
androiddrew 6 years ago
parent 4b08850756
commit 2dca458c16

@ -1,16 +1,18 @@
from matplotlib import pyplot as plt
friends = [70, 65, 72, 63, 71, 64, 60, 64, 67, ]
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']
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.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")

@ -19,4 +19,3 @@ plt.ylabel("Test 2 grade")
plt.axis([40, 120, 40, 120])
# plt.axis('equal')
plt.show()

@ -0,0 +1,15 @@
import seaborn as sns
import pandas as pd
from matplotlib import pyplot as plt
years = [year for year in range(1950, 2020, 10)]
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]
data = pd.DataFrame(data=gdp, index=years, columns=["gdp"])
sns.set(style="darkgrid")
sns.lineplot(data=data, markers="o")
plt.xlabel("Years")
plt.ylabel("Billions of $")
plt.show()

@ -1,2 +1,3 @@
matplotlib==3.0.2
black
seaborn==0.9.0
Loading…
Cancel
Save