Using PyLab to create 2D plot from two separate lists

This seems like a basic problem with an easy answer, but I just can't figure it out no matter how hard 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 collection 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 for the best graphics for these items?

+2


a source to share


1 answer


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()

      



+5


a source







All Articles