Skip to content

add_lines misses lines for matplotlib.colorbar.ColorbarBase #12458

Closed

Description

@e3reiter

Bug report

Bug summary

For matplotlib.colorbar.ColorbarBase(...) usage of add_lines(...) may yield missing lines/poorly adjusted lines.

Code for reproduction

import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np

fig = plt.figure()
ax = fig.add_axes([0.05, 0.8, 0.9, 0.15])
cmap = mpl.cm.cool
norm = mpl.colors.Normalize(vmin=-4, vmax=4)
levels = (-1.0, 1.0, 2.0, 3.0)

cb = mpl.colorbar.ColorbarBase(ax, cmap=cmap, norm=norm)
colors_bg = np.tile(list((1.0, 1.0, 1.0, 1.0)), (len(levels), 1))
cb.add_lines(levels=levels, colors=colors_bg, linewidths=7)

plt.show()

Expected outcome

4 white lines, crossing the colorbar.
Used to work on matplotlib 2.2.3!

Matplotlib version

  • Operating system: Ubuntu 18.04 LTS
  • Matplotlib version: 3.0.0
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.0

Miniconda install, fully updated.

Activity

  1. jklymak commented on Oct 9, 2018

    @jklymak
    Member

    I'm pretty sure I know whats going on. OTOH, can you provide an image of what you want this to look like? Four big thick white lines across a really wide colorbar?

  2. jklymak commented on Oct 9, 2018

    @jklymak
    Member

    Thanks - bug fix is in #12461

  3. added this to the v3.0.x milestone on Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions