- import matplotlib.pyplot as plt
- import pandas as pd
- from pylab import mpl
-
- mpl.rcParams["font.sans-serif"] = ["SimHei"]
-
- data = {'频率比例w/wr': [1.036, 1.030, 1.025, 1.020, 1.012, 1.007, 1.002,0.997,0.993,0.990,0.986,0.977,0.969],
- '振幅测量值θ(度)': [51, 60, 68, 81, 107, 122, 132, 135, 127,115,103,76,61]}
- df = pd.DataFrame(data)
- df.set_index('频率比例w/wr', inplace=True)
-
- df.plot(kind='line', y='振幅测量值θ(度)', marker='o')
-
- plt.title('幅频特性曲线')
- plt.xlabel('频率比例w/wr')
- plt.ylabel('振幅测量值θ(度)')
-
- df_reset = df.reset_index()
-
- for i, txt in enumerate(df_reset['振幅测量值θ(度)']):
- plt.annotate(f'({df_reset["振幅测量值θ(度)"][i]}, {df_reset["频率比例w/wr"][i]:.3f})', (df_reset['频率比例w/wr'][i], df_reset['振幅测量值θ(度)'][i]), ha='center',
- va='bottom', textcoords='offset points', xytext=(0, 5))
-
- plt.show()
- import matplotlib.pyplot as plt
- import pandas as pd
- from pylab import mpl
-
- mpl.rcParams["font.sans-serif"] = ["Microsoft YaHei"]
-
- data = {'频率比例w/wr': [1.036, 1.030, 1.025, 1.020, 1.012, 1.007, 1.002,0.997,0.993,0.990,0.986,0.977,0.969],
- '相位差测量值£(度)': [-161, -155,-150,-144,-135,-123,-103,-85,-70,-60,-50,-40,-30]}
- df = pd.DataFrame(data)
- df.set_index('频率比例w/wr', inplace=True)
-
- df.plot(kind='line', y='相位差测量值£(度)', marker='o')
-
- plt.title('相频特性曲线')
- plt.xlabel('频率比例w/wr')
- plt.ylabel('相位差测量值£(度)')
-
- df_reset = df.reset_index()
-
- for i, txt in enumerate(df_reset['相位差测量值£(度)']):
- plt.annotate(f'({df_reset["相位差测量值£(度)"][i]}, {df_reset["频率比例w/wr"][i]:.3f})', (df_reset['频率比例w/wr'][i], df_reset['相位差测量值£(度)'][i]), ha='center',
- va='bottom', textcoords='offset points', xytext=(0, 5))
-
- plt.show()