python - matplotlib 更改现有 skimage 图上的线宽

标签 python matplotlib scikit-image

我正在使用封装在 skimage 中的绘图函数来绘制两组关键点之间的匹配。特别是,我正在使用这个函数:plot_matches

这很好用,但是绘制的线条很粗。我知道使用 matplotlib 可以使用绘图中的 linewidth 参数控制线宽。在这种情况下,绘图函数由链接中的 plot_matches 函数调用。

顺便,我是这样使用的:

import matplotlib.pyplot as plt
from skimage.feature import plot_matches

fig, ax = plt.subplots()
plt.gray()
plot_matches(ax, img1, img2, k1[:, [0, 1]],
             k2[:, [0, 1]], matches, only_matches=True)
ax.axis('off')
plt.show()

有没有办法控制这种用法中的线宽属性?

最佳答案

另一种可能的解决方案是获取 line2D 对象的列表,然后使用 set_linewidth() 更改线宽

lines = ax.lines
for line in lines:

    line.set_linewidth(2)

关于python - matplotlib 更改现有 skimage 图上的线宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48547230/

相关文章:

python - 如何以正确的方式为独立的 python 应用程序制作 setup.py?

python - 如何在anaconda中导入pyspark

python - 更改 matplotlib 中多个子图的 y 轴

python - Matplotlib:使用 PySAL 自然中断时颜色条中断

python - 在轴上绘制图形但在尝试基于 HoG 特征对图像进行分类时没有得到结果

python --path=/path/to/my/module/?

python - 如何使用 Python MAPI 从 Outlook 获取 'Recipient' 姓名和电子邮件地址

python - 尝试加载腌制的 matplotlib 图时出现 AttributeError

python - networkx.exception.NodeNotFound 即使节点存在

python - 从图像中提取数字和字母特征