Skip to content

fix regression of axline behavior with non-linear scales #19485

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

Merged
merged 2 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,8 @@ def __init__(self, xy1, xy2, slope, **kwargs):

def get_transform(self):
ax = self.axes
points_transform = self._transform + ax.transData.inverted()
points_transform = self._transform + ax.transData.inverted()\
+ ax.transScale

if self._xy2 is not None:
# two points were given
Expand Down
13 changes: 13 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4103,6 +4103,19 @@ def test_eb_line_zorder():
ax.set_title("errorbar zorder test")


@check_figures_equal()
def test_axline_loglog(fig_test, fig_ref):
ax = fig_test.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3, .6], [.3, .6], ".-")
ax.axline((1, 1e-3), (10, 1e-2), c="k")

ax = fig_ref.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3, .6], [.3, .6], ".-")
ax.loglog([1, 10], [1e-3, 1e-2], c="k")


@check_figures_equal()
def test_axline(fig_test, fig_ref):
ax = fig_test.subplots()
Expand Down