Skip to content

add_lines misses lines for matplotlib.colorbar.ColorbarBase #12458

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
e3reiter opened this issue Oct 9, 2018 · 2 comments · Fixed by #12461
Closed

add_lines misses lines for matplotlib.colorbar.ColorbarBase #12458

e3reiter opened this issue Oct 9, 2018 · 2 comments · Fixed by #12461
Milestone

Comments

@e3reiter
Copy link

e3reiter commented Oct 9, 2018

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.

@jklymak
Copy link
Member

jklymak commented Oct 9, 2018

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?

@jklymak
Copy link
Member

jklymak commented Oct 9, 2018

Thanks - bug fix is in #12461

@dstansby dstansby added this to the v3.0.x milestone Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants