tools
This commit is contained in:
29
test.py
29
test.py
@@ -1190,6 +1190,31 @@
|
||||
# for i in a:
|
||||
# i = i.strip()
|
||||
# print(f"{{'name': '{i}', 'value': '', 'astrict': ''}},")
|
||||
import pandas as pd
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
for i in range(26):
|
||||
print(f'<option value="{i}">{i}</option>')
|
||||
df = pd.read_csv('AirPassengers.csv')
|
||||
|
||||
# Draw Plot
|
||||
plt.plot(df['date'], df['value'], color='#365770')
|
||||
|
||||
# Decoration
|
||||
plt.ylim(50, 750)
|
||||
xtick_location = df.index.tolist()[::12]
|
||||
xtick_labels = [x[-4:] for x in df.date.tolist()[::12]]
|
||||
plt.xticks(ticks=xtick_location,
|
||||
labels=xtick_labels,
|
||||
rotation=0,
|
||||
fontsize=12,
|
||||
horizontalalignment='center',
|
||||
alpha=.7)
|
||||
plt.yticks(fontsize=12, alpha=.7)
|
||||
plt.title("Air Passengers Traffic (1949 - 1969)", fontsize=18)
|
||||
plt.grid(axis='both', alpha=.3)
|
||||
|
||||
# Remove borders
|
||||
plt.gca().spines["top"].set_alpha(0.0)
|
||||
plt.gca().spines["bottom"].set_alpha(0.3)
|
||||
plt.gca().spines["right"].set_alpha(0.0)
|
||||
plt.gca().spines["left"].set_alpha(0.3)
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user