【问题标题】:How to set up the properties in matplotlib subplot?如何在 matplotlib 子图中设置属性?
【发布时间】:2019-10-18 14:03:28
【问题描述】:

我想在 matplotlib 中制作子图并设置不同的属性: 但我有一个错误'AxesSubplot' object has no attribute 'setp'

fig, ax = plt.subplots()

ax.axvline(x=654.31, linewidth=4, ls = '--', color = 'Gold' )

(markers, stemlines, baseline) = ax.stem(dfs.index, dfs.RTCM)
ax.setp(stemlines, linestyle="-", color="olive", linewidth=0.5 )

我找不到解决问题的方法。 我将不胜感激。

【问题讨论】:

  • 这个错误需要从字面上理解:该命令根本不存在。而是plt.setp

标签: python-3.x matplotlib subplot


【解决方案1】:

可以直接在stem函数中设置线条格式和颜色

ax.stem(dfs.index, dfs.RTCM, linefmt='C4-', markerfmt='D')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-22
    • 1970-01-01
    • 2015-05-20
    • 2013-04-09
    • 2013-03-29
    • 1970-01-01
    • 2022-11-23
    相关资源
    最近更新 更多