Description
Bug report
Bug summary
I am encountering a few seemingly related issues but can't exactly define what's happening. They broadly relate to unexpected changes in how plots are scaled and appear in the context of using the transform objects attached to the Axes. I assume they are caused by changes in autoscaling in 3.2, but don't know whether they are a bug or if previous code was relying on undefined behavior (the release notes are a little vague about what actually changed).
Code for reproduction
Here is a simple example derived from an issue in seaborn rugplot (mwaskom/seaborn#2015)
import numpy as np
import matplotlib as mpl
import matplotlib.transforms as tx
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
a = [1, 2, 4]
height = .2
xy_pairs = np.column_stack([np.repeat(a, 2), np.tile([0, height], len(a))])
line_segs = xy_pairs.reshape([len(a), 2, 2])
f, ax = plt.subplots()
trans = tx.blended_transform_factory(ax.transData, ax.transAxes)
ax.add_collection(LineCollection(line_segs, transform=trans))
ax.autoscale_view(scalex=True, scaley=False)
Actual outcome
With matplotlib 3.2.1:
Expected outcome
With matplotlib 3.1.2:
Matplotlib version
- Operating system: macos
- Matplotlib version: 3.2.1
- Matplotlib backend (
print(matplotlib.get_backend())
): ipython inline
Other information
Linking another seaborn issue (mwaskom/seaborn#2013) where there has been a similar change in behavior with matplotlib 3.2 but where it's harder to extract a standalone issue.