8000 make_axes_locatable : Colorbar in the middle instead of bottom while saving a pdf, png. · Issue #12624 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

make_axes_locatable : Colorbar in the middle instead of bottom while saving a pdf, png. #12624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
navdeeprana opened this issue Oct 25, 2018 · 3 comments

Comments

@navdeeprana
Copy link

cax added using make_axes_locatable shows up at the middle of the image, instead of bottom while saving figures. I have tried .png and .pdf . The output from plt.show() is correct.

python 3.6.6 :: Anaconda custom (64-bit)
numpy version 1.15.3
matplotlib version 3.0.0

Here's a minimal script, which reproduces the result

import numpy as np
from matplotlib import pyplot as plt 
from mpl_toolkits.axes_grid1 import make_axes_locatable

epsilon = np.random.rand(128,128)
fig,ax = plt.subplots(figsize=(6,6))
cax = make_axes_locatable(ax).append_axes('bottom', size='5%', pad = 0.05)
im = ax.imshow(epsilon,origin='lower')
fig.colorbar(im,cax=cax,orientation='horizontal')
fig.tight_layout()
fig.savefig('test.png',dpi=200,bbox_inches='tight')
plt.show()
@navdeeprana navdeeprana changed the title make_axes_locatable : Colorbar in the middle instead of bottom while saving a pdf. make_axes_locatable : Colorbar in the middle instead of bottom while saving a pdf,png. Oct 25, 2018
@navdeeprana navdeeprana changed the title make_axes_locatable : Colorbar in the middle instead of bottom while saving a pdf,png. make_axes_locatable : Colorbar in the middle instead of bottom while saving a pdf, png. Oct 25, 2018
@jklymak
Copy link
Member
jklymak commented Oct 25, 2018

This has already been reported and will be fixed 3.0.1. To avoid until 3.0.1 is released don’t use tight layout or revert to 2.2.3.

Thanks and sorry for the bother.

@jklymak jklymak closed this as completed Oct 25, 2018
@navdeeprana
Copy link
Author

Thank you for the information. I tried searching if it was already reported or not. I found similar issues but not the same.

@jklymak
Copy link
Member
jklymak commented Oct 25, 2018

I can confirm that this seems to work fine in the just-tagged v.3.0.1... This was closed by #12363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0