8000 axes.spy plotting function doesn't respect origin='lower' kwarg when marker is not None · Issue #16252 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
axes.spy plotting function doesn't respect origin='lower' kwarg when marker is not None #16252
Closed
@proteins247

Description

@proteins247

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')

Actual outcome
spy_point_marker

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:
spy_default_marker

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0