Closed
Description
Min/max markers on box plot are not visible with 'dark_background' theme
The min & max markers (the short lines at the ends of the whiskers) aren't visible with the 'dark_background' theme
Code for reproduction
import pandas as pd
import matplotlib.pyplot as plt
# Data is from the pandas plotting demo
# https://pandas.pydata.org/docs/getting_started/intro_tutorials/04_plotting.html
air_quality = pd.read_csv("air_quality_no2.csv", index_col=0, parse_dates=True)
plt.style.use('default')
air_quality.plot.box()
plt.style.use('dark_background')
air_quality.plot.box()
Actual outcome
Software versions
- Matplotlib version: 3.3.1
- Matplotlib backend: module://ipykernel.pylab.backend_inline
- Python version: 3.8.6
- Jupyterlab version: 3.0.12
- Pandas: 1.2.3
- Operating system: Sage Math 9.2 installation running on Ubuntu 20.10 on WSL in windows 10 64-bit
Activity
diegopetrola commentedon Mar 31, 2021
I tried to reproduce this somehow using only matplotlib and numpy and was unable to.
Here is an exemple code:
And the outcome is:

I also briefly investigated pandas and it seems they have a function called
_get_standard_colors()
in line 83 of the script calledboxplot.py
. I am fairly confident that it is this function that overrides the theme and causes the issue.If you manage to reproduce this without using pandas, please let us know but, as of now, I believe the issue should be redirected to them.
For now you can change the last line of your code to
air_quality.plot.box(capprops=dict(color='white'))
or any other color you like to have the markers appear in the figure. If you want further information on how to customize the colors of a boxplot you can read more here.jklymak commentedon Mar 31, 2021
Thanks @diegopetrola, I'll close this.
sandyscott commentedon Apr 3, 2021
Thank you, I've reported the issue in pandas.