Hey Guys,

This seems like a basic problem with an easy answer but I simply cannot figure it out no matter 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?

Recommended Answers

All 2 Replies

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

In matplotlib you can use xticks()

The first list is where each text piece will be placed, and the second is a tuple of strings.

xticks([1,2,3,4,5], ("Jan-06","Jul-06","Jan-07","Jul-07","Jan-08"))

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.