Description
Bug report
Bug summary
spy
always draws with the origin in the upper left corner if marker
is not None
, even if origin='lower'
is provided as a keyword argument.
Code for reproduction
points = np.zeros([10, 5])
points[5:] = 1
fig, ax = plt.subplots()
ax.spy(points, marker='.', origin='lower')
After this point, the origin appears to be fixed in the upper left corner. Any subsequent commands (imshow
, spy
) seem to ignore origin='lower'
.
Expected outcome
Note that ax.spy(points, origin='lower')
(omitting the marker
argument) works properly:
Though it's worth pointing out that the x-axis ticks and labels always end up in upper spine, not the lower one, regardless of origin='upper'
or origin='lower'
. The behavior of imshow
is a bit different. If origin='lower'
, the ticks and labels are moved to the bottom.
The documentation for spy notes that:
If *Z* is a `scipy.sparse.spmatrix` or *marker* or *markersize* are
*None*, a `~matplotlib.lines.Line2D` object will be returned with
the value of marker determining the marker type, and any
remaining kwargs passed to `~.Axes.plot`.
So that seems to explain why including marker
changes the function's behavior.
Matplotlib version
- Operating system: Centos 7
- Matplotlib version: 3.1.2
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: 3.6.8
- Jupyter version (if applicable):
- Other libraries:
Installed using anaconda.