小编sps*_*pst的帖子

如何在 Python3 中输入提示 matplotlib Figure 对象

我正在尝试为 plt.subplots 返回的数据添加类型提示。这对于 plt.Axes 来说效果很好,但我似乎找不到图的解决方案。

有什么想法我可以做什么吗?

我的代码的缩写版本是:

def draw_graph() -> Tuple[plt.Figure, plt.Axes]: 

    fig, ax = plt.subplots(figsize=(14,10))
    return (fig, ax)
Run Code Online (Sandbox Code Playgroud)

我收到消息:“Figure”不是模块 Pylance 的已知成员

python matplotlib type-hinting

4
推荐指数
1
解决办法
2175
查看次数

标签 统计

matplotlib ×1

python ×1

type-hinting ×1