使用带有pandas / python

时间:2018-05-08 21:51:50

标签: python python-2.7 pandas matplotlib plot

我想根据字典中的数据制作一个简单的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")

1 个答案:

答案 0 :(得分:2)

该命令看起来像

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

即。您从字典中选择"str1"条目,然后将其解压缩到x的{​​{1}}和y个参数。