开发者

Using PyLab to create a 2D graph from two separate lists

This seems like a basic problem with an easy answer but I simply cannot figure it out no matte开发者_运维问答r how much I try.

I am trying to create a line graph based on two lists. For my x-axis, I want my list to be a set of strings.

x_axis_list = ["Jan-06","Jul-06","Jan-07","Jul-07","Jan-08"]
y_axis_list = [5,7,6,8,9]

Any suggestions on how to best graph these items?


from pylab import *
from matplotlib.font_manager import FontProperties

dates = ["Jan-06","Jul-06","Jan-07","Jul-07","Jan-08"]
x_axis_list = range(len(dates))
y_axis_list = [5,7,6,8,9]

figure()
plot(x_axis_list, y_axis_list, "k")
xticks(x_axis_list, dates, rotation=45)
show()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜