> plt.text(zb[link],-1.2,year,ha='center')#需要根據(jù)自己的位置調(diào)整Y的坐標即調(diào)整-1
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
plt.rcParams['font.sans-serif']=['SimHei'] #用來正常顯示中文標簽
plt.rcParams['axes.unicode_minus']=False #用來正常顯示負號
time1 =input("輸入一個時間(時、分、秒以空格分割):")
year = input('請輸入年份,格式如 2019-8-30 :')
n = input('請輸入X軸分段數(shù):')
old_time_x = []
time1List = time1.split(" ")
time1List = [int(x) for x in time1List]
'''時間轉(zhuǎn)化'''
shi = time1List[0]
fen = time1List[1]
miao = time1List[2]
for x in range(eval(n)+1):
time_x = '%02d:%02d:%02d'%(shi,fen,miao)
old_time_x.append(time_x)
miao += 60
while miao >= 60:
miao = miao - 60
fen += 1
while fen >= 60:
fen = fen -60
shi += 1
while shi > 24:
shi = shi - 24
print(old_time_x)
x = np.arange(0,10,1)
y = np.arange(0,10,1)
fig = plt.figure(figsize=(12,6))
plt.xticks(np.linspace(0,9,eval(n)),old_time_x,rotation=0)
zb = np.linspace(0,9,eval(n))
print(zb)
for link in range(len(zb)):
plt.text(zb[link],-1.2,year,ha='center')#需要根據(jù)自己的位置調(diào)整Y的坐標即調(diào)整-1
plt.plot(x,y)