Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pyplot hlines and vlines do not use the 'lines.color' property in rcParams by default #16482

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
maij opened this issue Feb 12, 2020 · 7 comments

Comments

@maij
Copy link

maij commented Feb 12, 2020

Bug report

Bug summary

hlines and vlines color does not default to lines.color in rcParams. The default argument is 'k' which doesn't work with dark backgrounds.

Code for reproduction

import matplotlib.pyplot as plt
import matplotlib as mpl
plt.style.use('dark_background')

plt.figure()
with mpl.rc_context({'lines.color':'white'}):
   plt.hlines(0.5, 0, 1) # defaults to a black line, which doesn't work with a dark background
   plt.vlines(0.5, 0, 1, colors=None) # This will fall back to `lines.color`

Actual outcome

image

Expected outcome

image

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.4
  • Jupyter version (if applicable):
  • Other libraries:
@RiazCharania
Copy link

Is anyone else currently working on this? If not I'll give it a try.

@JacobChamberlain
Copy link

We would like to work on this issue if you have not started yet.

@maij
Copy link
Author

maij commented Mar 3, 2020

You're more than welcome to get started on this! I haven't started yet.

@RiazCharania
Copy link

We would like to work on this issue if you have not started yet.

My team has already started on it, sorry.

You're more than welcome to get started on this! I haven't started yet.

Thanks for the confirmation!

@ImportanceOfBeingErnest
Copy link
Member

There is discussion in #16714 about whether axhline should use the grid's color or spline color. I suppose that would apply to vlines/hlines as well. So probably this needs more discussion.

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.3.0 milestone Mar 10, 2020
pgowthami added a commit to CSCD01-team23/matplotlib that referenced this issue Mar 11, 2020
@timhoffm
Copy link
Member

I suppose that would apply to vlines/hlines as well.

Not necessarily. axhline is typically used for marking single special values (e.g. https://matplotlib.org/devdocs/gallery/pyplots/axline.html). Whereas hlines are more data like, so it might make sense to have them use the color cycle, but that of course, would be a breaking change, which is probably only viable for 4.0.

McCoubs added a commit to CSCD01-team31/matplotlib that referenced this issue Apr 5, 2020
McCoubs added a commit to CSCD01-team31/matplotlib that referenced this issue Apr 5, 2020
…ine with issue matplotlib#16482

added test coverage for changes to pyplot hlines() and vlines() interface

adding API changes to api_changes

updated Axes.vlines and Axes.hline docstring inline with changes

updated spacing to be 2 line compliant
McCoubs added a commit to CSCD01-team31/matplotlib that referenced this issue May 6, 2020
…ine with issue matplotlib#16482

added test coverage for changes to pyplot hlines() and vlines() interface

adding API changes to api_changes

updated Axes.vlines and Axes.hline docstring inline with changes

updated spacing to be 2 line compliant
McCoubs added a commit to CSCD01-team31/matplotlib that referenced this issue May 20, 2020
…ine with issue matplotlib#16482

added test coverage for changes to pyplot hlines() and vlines() interface

adding API changes to api_changes

updated Axes.vlines and Axes.hline docstring inline with changes

updated spacing to be 2 line compliant

updated implementation for iss-16482 inline with review comments

removed unnecessary import of image_comparator decorator

running boilerplate.py to update vlines/hlines methods

updating inline with review comments

fixing flake8 errors

updating inline with reviewer comments

updating inline with reviewer comments
McCoubs added a commit to CSCD01-team31/matplotlib that referenced this issue May 29, 2020
…ine with issue matplotlib#16482

added test coverage for changes to pyplot hlines() and vlines() interface

adding API changes to api_changes

updated Axes.vlines and Axes.hline docstring inline with changes

updated spacing to be 2 line compliant

updated implementation for iss-16482 inline with review comments

removed unnecessary import of image_comparator decorator

running boilerplate.py to update vlines/hlines methods

updating inline with review comments

fixing flake8 errors

updating inline with reviewer comments

updating inline with reviewer comments

updated vlines/hlines default color tests inline with code review
@timhoffm
Copy link
Member

timhoffm commented Jun 8, 2020

Closed by #16953.

@timhoffm timhoffm closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants