-
Notifications
You must be signed in to change notification settings - Fork 103
x axis inverts when using plot with negative y #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that this issue doesn`t occur when using matplotlib import numpy as np fig = plt.figure() ax = plt.subplot() ax.set_xlabel('x axis') ax.scatter(-1, 1, color="b") #x_set = [-1, 1] x_set = [1, -1] ax.plot(x_set, y_set, color="r") |
This is part of the "standardized arguments" feature (see this link)... but unfortunately I did not document it! I'll add this to the docs in the next version. I find that most of the time, when I have "reversed" dependent variable coordinates, I want that axis to be reversed too. So I think I'd prefer to keep this default behavior. In your example, you can use |
Ok, I understand your point. Thanks for the reply |
No problem. FYI the master branch now includes documentation on auto-reversing in the "1D plotting" and "2D plotting" sections, and auto-reversing is now automatically disabled whenever the axis limits were previously explicitly fixed with e.g. |
Description
within cartesian grid, using plot, x axis inverts with y set starting with nagative number
Steps to reproduce
import numpy as np
import proplot as pplt
print(pplt.version)
fig = pplt.figure(suptitle='test')
ax = fig.subplot(111, title="A-B")
ax.format(xlim=(-2, 2),
xticks=0.5,
xloc=('data', -2),
xlabel='x axis',
xlabelloc='bottom',
ylim=(-2, 2),
yticks=0.5,
yloc=('data', -2),
ylabel='y axis')
ax.set_aspect('equal')
ax.scatter(-1, 1, color="b")
ax.text(-1, 1, "A")
ax.scatter(1, -1, color="b")
ax.text(1, -1, "B")
x_set = [-1, 1]
y_set = [1, -1]
ax.plot(x_set, y_set, color="r")
pplt.show()
Expected behavior:
The above code gives a grid as expected, with the 2 points A and B and a red line between them

Actual behavior: [What actually happened]
However, when changing the x_set/y_set lines to
x_set = [1, -1]
y_set = [-1, 1]
the x-axis inverts (i.e. the whole grid) starting with x = 2 going to x = -2
Equivalent steps in matplotlib
with ax.invert_xaxis() the grid inverts to the presentation as expected
Proplot version 0.9.5
Paste the results of
import matplotlib; print(matplotlib.__version__); import proplot; print(proplot.version)
here.The text was updated successfully, but these errors were encountered: