Issue
I have a plot with x-values from 1000 to 1400. The list it comes from starts with 1400 and ends with 1000 (thus: [1400, 1399, ... , 1001, 1000]).
When I plot this, the plot starts at 1000 and ends with 1400 (from left to right). Very logical, but I want this reversed. I know how to revert an axis, but that is only reverting the labels. The plot remains the same and the plot itself should be reversed as well.
Is this even possible?
Solution
import matplotlib.pyplot as plt
# Define the x and y values
x = [1400, 1399, ..., 1001, 1000]
y = [..., ..., ..., ..., ...]
# Reverse the order of the x values
x_reversed = x[::-1]
# Create the line plot
plt.plot(x_reversed, y)
# Show the plot
plt.show()
Answered By - user3864993
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.