Skip to content
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

Addresses issue #23129: Fixed log scale order dependency when using Collections #28021

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,10 @@ def get_datalim(self, transData):
# No paths to transform
return transforms.Bbox.null()

if not transform.is_affine:
paths = [transform.transform_path_non_affine(p) for p in paths]
# Don't convert transform to transform.get_affine() here because
# we may have transform.contains_branch(transData) but not
# transforms.get_affine().contains_branch(transData). But later,
# be careful to only apply the affine part that remains.
# Don't convert transform to transform.get_affine() here because
# we may have transform.contains_branch(transData) but not
# transforms.get_affine().contains_branch(transData). But later,
# be careful to only apply the affine part that remains.

offsets = self.get_offsets()

Expand Down
20 changes: 20 additions & 0 deletions lib/matplotlib/tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,26 @@ def test_collection_log_datalim(fig_test, fig_ref):
ax_ref.plot(x, y, marker="o", ls="")


@mpl.style.context('mpl20')
@check_figures_equal(extensions=['png'])
def test_collection_log_datalim_order_dependency(fig_test, fig_ref):
xy = np.c_[np.arange(50), np.linspace(1, 100, 50)]
lines_test = mpl.collections.LineCollection(segments=[xy])
lines_ref = mpl.collections.LineCollection(segments=[xy])

ax_test = fig_test.subplots()
ax_test.set_xscale('log')
ax_test.set_yscale('log')
ax_test.add_collection(lines_test)
ax_test.autoscale_view()

ax_ref = fig_ref.subplots()
ax_ref.add_collection(lines_ref)
ax_ref.set_xscale('log')
ax_ref.set_yscale('log')
ax_ref.autoscale_view()


def test_quiver_limits():
ax = plt.axes()
x, y = np.arange(8), np.arange(10)
Expand Down