【问题标题】:Plot a two dimensional array using a dictionary with pandas/python使用带有 pandas/python 的字典绘制二维数组
【发布时间】:2018-10-18 22:40:53
【问题描述】:

我想根据字典中的数据制作一个简单的 XY 图。我的数据看起来像这样:

D = {'str1': [[1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]],'str2': [[8, 9, 
10, 11, 12], [8, 9, 10, 11, 12]]}

有没有办法只绘制,例如,第一个字典形式 D。 该命令应该类似于

plt.plot("str1")

【问题讨论】:

  • plt.plot(D['str1'][0],D['str1'][1])

标签: python python-2.7 pandas matplotlib plot


【解决方案1】:

命令看起来像

plt.plot(*D["str1"])

即您从字典中选择 "str1" 条目并将其解压缩到 plotxy 参数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-05
    • 1970-01-01
    • 2019-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多