2

I've got a matplotlib plot which I'm creating with the following code:

# Plot times for completion
print "Plotting Completion Times"    
plt.plot(x, y)

plt.title("Completion Times")
plt.xlabel("Times (In Seconds)")
plt.xticks(x, x)
plt.ylabel("Percentage of completion")

plt.show()

The plot comes out correctly, but the xticks which I have set on the x-axis end up overlapping and now I can't read them properly. The resultant x-axis ticks look like this:

enter image description here

You can see that there are five marked points, but I don't know what any of their full values are.

Is there a way I can make the values display at an angle so that they are all fully visible?

Community
  • 1
  • 1
tushariyer
  • 906
  • 1
  • 10
  • 20

1 Answers1

1

you can basically set explicitly the steps between xticks distance by plt.xticks(np.arange(min(x), max(x)+1, 1.0)) they will be evenly spaced with 1.0 distance between each tick from min(x) to max(x)+1, you can increase 1.0 to any value that is confortable with you

Eliethesaiyan
  • 2,327
  • 1
  • 22
  • 35