Python 控制包 - 提高奈奎斯特绘图的分辨率

标签 python matplotlib

我正在使用 Python 控制模块来绘制传递函数的伯德图和奈奎斯特图。代码简单如下:

<小时/>
# Simple Nyquist plotting

import control
import matplotlib.pyplot as plt

num = 5
den = [1,6,11,6]

#Creating a transfer function G = num/den
G = control.tf(num,den) 

control.nyquist(G)
plt.grid(True)
plt.title('Nyquist Diagram of G(s) = 5/(s+1)(s+2)(s+3)')
plt.xlabel('Re(s)')
plt.ylabel('Im(s)')
plt.show()
<小时/>

绘制奈奎斯特图: enter image description here

我想知道是否可以增加图形的点数,提高其分辨率。

最佳答案

请注意,图中存在所有数据点。您只需放大窗口即可看到所有点。

您可以手动执行此操作(只需放大绘图窗口),也可以set the plot window in Matplotlib在显示结果之前:

If you've already got the figure created you can quickly do this:

fig = matplotlib.pyplot.gcf()
fig.set_size_inches(18.5, 10.5)
fig.savefig('test2png.png', dpi=100)

要将大小更改传播到现有 GUI 窗口,请添加forward=True

fig.set_size_inches(18.5, 10.5, forward=True)

关于Python 控制包 - 提高奈奎斯特绘图的分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31103784/

相关文章:

python 如何在不从列表中删除元素的情况下按出现次数对列表进行排序?

python - 确定递归算法的计算复杂度

python - Conda 在使用 channel 时无法解析 requirements.yml

Python:复制 basemap 或从图中删除数据

python - 分别保存散点图的颜色条

python - Firefox 附加组件 : 1) Linking Python script to add-on main code | 2) win32 api in JPM/NPM | 3) set file attributes in Windows with OS. 文件

python - 如何在 Graph Networkx 中找到具有公共(public)节点的边?

python - 使用 matplotlib 绘制 Char 数据的 Pandas DataFrame

python - 用户鼠标在绘图上输入积分限制 - python

python - 将整数日期时间转换为日期时间格式