Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Runtime error in grid_spec.tight_layout() #1055

Closed
@ton

Description

@ton

The following example using grid_spec.tight_layout in combination with a color bar causes a RuntimeError in tight_layout.py:

import matplotlib
import matplotlib.pyplot as pyplot

fig = pyplot.figure()

grid_spec = matplotlib.gridspec.GridSpec(nrows=1, ncols=1)

ax = fig.add_subplot(grid_spec[0])
im = ax.imshow([[1, 2], [3, 4]])
pyplot.colorbar(im, use_gridspec=True)

grid_spec.tight_layout(fig)

fig.show()

raw_input("Press Enter to continue...")

Using pyplot.tight_layout() instead of grid_spec.tight_layout() works, but has the drawback that pyplot.tight_layout() does not accept the rect parameter.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions