change axis x to time

This commit is contained in:
2024-07-18 17:45:40 +08:00
parent e1866758b7
commit 370fa051ae
4 changed files with 46 additions and 34 deletions

View File

@ -27,22 +27,22 @@ customtkinter.set_window_scaling(1.1) # window geometry dimensions
setdefaulttimeout(3)
# global vars
durable_data_current = {
'time': list(range(1, 26)),
'axis1': [0 for _ in range(25)],
'axis2': [0 for _ in range(25)],
'axis3': [0 for _ in range(25)],
'axis4': [0 for _ in range(25)],
'axis5': [0 for _ in range(25)],
'axis6': [0 for _ in range(25)],
'time': list(range(1, 19)),
'axis1': [0 for _ in range(18)],
'axis2': [0 for _ in range(18)],
'axis3': [0 for _ in range(18)],
'axis4': [0 for _ in range(18)],
'axis5': [0 for _ in range(18)],
'axis6': [0 for _ in range(18)],
}
durable_data_current_max = {
'time': list(range(1, 26)),
'axis1': [0 for _ in range(25)],
'axis2': [0 for _ in range(25)],
'axis3': [0 for _ in range(25)],
'axis4': [0 for _ in range(25)],
'axis5': [0 for _ in range(25)],
'axis6': [0 for _ in range(25)],
'time': list(range(1, 19)),
'axis1': [0 for _ in range(18)],
'axis2': [0 for _ in range(18)],
'axis3': [0 for _ in range(18)],
'axis4': [0 for _ in range(18)],
'axis5': [0 for _ in range(18)],
'axis6': [0 for _ in range(18)],
}
btns_func = {
'start': {'btn': '', 'row': 1, 'text': '开始运行'},
@ -242,14 +242,20 @@ class App(customtkinter.CTk):
self.df_copy = df.copy()
self.old_curve = widgits_da['curvesel']['optionmenu'].get()
figure = plt.figure(frameon=True, facecolor='#E9E9E9')
plt.subplots_adjust(left=0.04, right=0.98, bottom=0.05, top=0.95)
plt.subplots_adjust(left=0.04, right=0.98, bottom=0.1, top=0.95)
_ = df['time'].to_list()
_xticks = [str(_i) for _i in _]
ax = figure.add_subplot(1, 1, 1)
ax.set_xticks(range(1, len(_xticks)+1))
ax.set_xticklabels(_xticks)
df.plot(grid=True, x='time', y='axis1', ax=ax)
df.plot(grid=True, x='time', y='axis2', ax=ax)
df.plot(grid=True, x='time', y='axis3', ax=ax)
df.plot(grid=True, x='time', y='axis4', ax=ax)
df.plot(grid=True, x='time', y='axis5', ax=ax)
df.plot(grid=True, x='time', y='axis6', ax=ax, title=_title, legend='upper left')
df.plot(grid=True, x='time', y='axis6', ax=ax, title=_title, legend='upper left', rot=30)
self.create_canvas(figure)