Issue
I'm trying to make a simple budget line graph that you would see in an economics class. But I need the slope of my line to be from 60 to 15 (inverse of what it is now).
I tried inversing the axis using numpy.flip() and plt.gca().invert_xaxis()
But I want to keep the x & y axis the same, just reverse the slope of the line so it shows from 60 too 15. I'm new to python and any help would be appreciated. I have included an image of my code below.
Solution
I think this is what you're looking for
plt.plot(x_[::-1], y)
The operation being done here reverses the order of the elements in the 'x_' array, resulting in the inverse of your slope.
Answered By - CDubyuh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.