Skip to content

quickplot.contourf colorbar not attached to supplied axes #4126

@rcomer

Description

@rcomer

🐛 Bug Report

Following on from #2946, when the axes labels were fixed. I just noticed that quickplot.contourf still attaches the colorbar to the current axes, even if a different axes is supplied.

How To Reproduce

import matplotlib.pyplot as plt
import iris
import iris.quickplot as qplt

fig1 = plt.figure()
fig2 = plt.figure()

fname = iris.sample_data_path('hybrid_height.nc')
theta = iris.load_cube(fname, 'air_potential_temperature')
cross_section = next(theta.slices(['grid_longitude',
                                   'model_level_number']))

ax = fig1.add_subplot(2, 1, 1)
qplt.contourf(cross_section, axes=ax)

plt.show()

Fig 1:
quickplot_colorbar_fig1

Fig 2:
quickplot_colorbar_fig2

Expected behaviour

Colorbar should be attached to the axes containing the contour plot.

Environment

  • OS & Version: RHEL 7.9
  • Iris Version: 3.1.dev0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions