1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import os
graph_num = 6
id_iq_graph_idx = 0
omega_graph_idx = 1
theta_graph_idx = 2
ctrl_theta_graph_idx = 3
ual_graph_idx = 4
ube_graph_idx = 5
voltage_graph_idx = 0
current_graph_idx = 1
# 创建2 列 6 行的画布
fig, ax_list = plt.subplots(ncols=2, nrows=graph_num, sharex=True, figsize=(24*0.8, 24*0.8), dpi=90, facecolor='w', edgecolor='k');
# wspace 图像的左右间距
# hspace 图像的上下间距
# top and bottom 是整个图像高度的百分比
fig.subplots_adjust(left=0.048, right=0.98, bottom=0.1, top=0.98, hspace=0.145, wspace=0.142)
ax_list[id_iq_graph_idx][0].plot(time, ll[0], 'r')
ax_list[id_iq_graph_idx][0].plot(time, ll[1], 'g')
ax_list[id_iq_graph_idx][0].set_ylabel(r'$i_s$ [V]')
ax_list[omega_graph_idx][0].plot(time, ll[2], 'r')
ax_list[omega_graph_idx][0].set_ylabel(r'$\omega$ [rpm]')
ax_list[theta_graph_idx][0].plot(time, ll[3], color='r', label='the')
ax_list[theta_graph_idx][0].set_ylabel(r'$\theta_{rm} \circ$')
ax_list[theta_graph_idx][0].set_yticks([0, 180, 360])
ax_list[ctrl_theta_graph_idx][0].plot(time, ll[12], 'y')
ax_list[ctrl_theta_graph_idx][0].set_ylabel(r'ctrl $\theta$')
ax_list[ctrl_theta_graph_idx][0].set_yticks([0, 180, 360])
ax_list[ual_graph_idx][0].plot(time, ll[10], 'b')
ax_list[ual_graph_idx][0].set_ylabel('ual')
ax_list[ube_graph_idx][0].plot(time, ll[11], 'g')
ax_list[ube_graph_idx][0].set_ylabel('ube')
ax_list[voltage_graph_idx][1].plot(time, ll[4], 'r')
ax_list[voltage_graph_idx][1].plot(time, ll[5], 'g')
ax_list[voltage_graph_idx][1].set_ylabel(r'voltage [V]')
ax_list[current_graph_idx][1].plot(time, ll[6], 'r')
ax_list[current_graph_idx][1].plot(time, ll[7], 'g')
ax_list[current_graph_idx][1].plot(time, ll[8], 'b')
ax_list[current_graph_idx][1].plot(time, ll[9], 'c')
ax_list[current_graph_idx][1].set_ylabel(r'MT current [A]')
# Automatic END
plt.show()
|