8000 In version 3.0.0 make_axes_locatable + colorbar does not produce expected result · Issue #12661 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
In version 3.0.0 make_axes_locatable + colorbar does not produce expected result #12661
Closed
@dchandan

Description

@dchandan

Bug report

Bug summary

In Matplotlib 3.0.0 using make_axes_locatable and append_axes functions to make a separate axis for colorbar does not function as it is supposed to.

Code for reproduction

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
from mpl_toolkits.axes_grid1.colorbar import colorbar

fig, (ax1, ax2) = plt.subplots(1, 2)
fig.subplots_adjust(wspace=0.5)

im1 = ax1.imshow([[1, 2], [3, 4]])
ax1_divider = make_axes_locatable(ax1)
cax1 = ax1_divider.append_axes("right", size="7%", pad="2%")
cb1 = colorbar(im1, cax=cax1)

im2 = ax2.imshow([[1, 2], [3, 4]])
ax2_divider = make_axes_locatable(ax2)
cax2 = ax2_divider.append_axes("top", size="7%", pad="2%")
cb2 = colorbar(im2, cax=cax2, orientation="horizontal")
cax2.xaxis.set_ticks_position("top")

plt.show()

Actual outcome

image

Expected outcome

From matplotlib gallery

image

Matplotlib version

  • Operating system: Mac OS Mojave
  • Matplotlib version: 3.0.0
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.6
  • Jupyter version (if applicable): 1.0.0
  • Other libraries:

All packages installed from default conda channel.

Metadata

Metadata

Assignees

No one assigned

    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

      0