8000 Incorrect axes positioning in axes_grid.Grid with direction='column' · Issue #20372 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Incorrect axes positioning in axes_grid.Grid with direction='column' #20372
Closed
@rgbmrc

Description

@rgbmrc

Bug report

Bug summary

Axes of mpl_toolkits.axes_grid1.axes_grid.Grid (and ImageGrid) are not positioned correctly when direction='column'. This affects, e.g., the tick labels (see figures).

Code for reproduction

import matplotlib.pyplot as plt
import mpl_toolkits.axes_grid1 as axg1
fig = plt.figure()
g = axg1.Grid(fig, 111, (2, 3), direction='column', axes_pad=0.5)

Actual outcome
grid_bug

Expected outcome
grid_bug_fix

Obtained appending

import numpy as np
g.axes_all = np.reshape(g.axes_all, g.get_geometry()).ravel(order='F')
g._init_locators()

I believe the culprit is

self.axes_all = axes_array.ravel().tolist()

When direction='column', axes_all are not sorted by creation order; as I think is expected by _init_locators and as likely indicated by the sentence "This also affects the order in which axes are accessed using indexing" in the description of direction in the ImageGrid (but not Grid) documentation.

Matplotlib version

  • Operating system: Debian 10 (on WSL2)
  • Matplotlib version: 3.4.2 (conda-forge)
  • Matplotlib backend: any
  • Python version: 3.9.2 (conda-forge)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0