Skip to content

Some subplot axes not displaying when using both gridspec_kw/width_ratios and subplot2grid #11434

@tiffanygwilson

Description

@tiffanygwilson

Bug report

Bug summary

When using a combination of plt.subplots with gridspec_kw/width_ratios along with plt.subplot2grid, some of the axes disappear when one of the width ratios is (in this case) below 0.73.

Code for reproduction

import matplotlib.pyplot as plt
fig, ax = plt.subplots(2,3,sharex=True, sharey=True, gridspec_kw={'width_ratios':[1,1,0.7]})
axi = plt.subplot2grid((2,3),(0,2),rowspan=2)
plt.show()

Actual outcome

image

Note that the axes only disappear with the call to subplot2grid. If I remove that line, all axes appear.

Expected outcome

If width_ratios is instead [1,1,0.8], all of the axes appear.
image

I can achieve the desired width ratios if I use GridSpec directly instead of using the wrappers, but it would be nice if the wrappers didn't fail based on the width_ratios parameter.

Matplotlib version

  • Operating system: Windows 10.0.15063
  • Matplotlib version: 2.1.0
  • Matplotlib backend: module://ipykernel.pylab.backend_inline
  • Python version: 3.6.3
  • IPython version: 6.1.0
  • Jupyter notebook server version: 5.4.1

mabplotlib and python installed via conda.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions