Skip to content

[Bug]: Colorbar is displaced when saving as .eps with bbox_inches='tight' #25176

Closed
@Thomassien

Description

@Thomassien

Bug summary

I am plotting with imshow() and create a colorbar. When saving the figure as .eps with savefig() and option bbox_inches='tight', the colorbar (without the spines) is displaced.

Code for reproduction

import matplotlib.pyplot as plt

fig = plt.figure()
plt.imshow([[1, 1], [1, 1]])
plt.colorbar()
plt.savefig("test.eps", bbox_inches='tight')
plt.show()

Expected outcome

Colorbar should be placed inside the spines as when using plt.show(). Also, saving as .png instead of .eps works correctly.

Actual outcome

test

Additional information

The bug does not happen when using Matplotlib version 5.2.3.

Operating system

Windows 10

Matplotlib version

3.6.3

Matplotlib backend

module://backend_interagg

Python version

3.11.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions