holoviz / holoviz/hvplot

Changing color of errorbars

Open
#1,438 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### ALL software version info

* hvplot version: 0.10.0
* Holoviews version : 1.19.1
* Bokeh version: 3.4.2
* Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0] on linux
* Firefox 131.0

#### Description of expected behavior and the observed behavior

When changing the color of *hvplot.errorbars*, the small horizontal lines at the end of the whiskers do not change color. They remain black. This makes it hard to see them when using a dark theme. It is also not helpful when comparing two plots where the error bars overlap as it makes it unclear which end belongs to which plot.

The expected behaviour is that setting the *color* option changes the color of the whole whisker, i.e both vertical and horizontal lines.

A second issue is that the errorbars are not turned off by clicking on the legend. Usually clicking on the legend will dim the selected curve. This does not work with errorbars.

#### Complete, minimal, self-contained example code that reproduces the issue

```python
import pandas as pd
import holoviews as hv
import hvplot.pandas
hv.extension('bokeh')

# Set dark theme
from bokeh.themes import built_in_themes
hv.renderer('bokeh').theme = built_in_themes['dark_minimal']

# Example data
df1 = pd.DataFrame({'mean':[1.51,2.0,1.53],'eb_min':[0.3, 0.3, 0.3],'eb_max':[0.15, 0.35, 0.35]})
df2 = pd.DataFrame({'mean':[2.1,2.2,2.3],'eb_min':[0.4, 0.35, 0.3],'eb_max':[0.15, 0.25, 0.35]})

# Dark background plot
plot_dark_bg = hv.Overlay([
df1.hvplot.scatter(y='mean',label='data 1')*df1.hvplot.errorbars(y='mean',yerr1='eb_min',yerr2='eb_max',color='cyan',label='data 1'),
df2.hvplot.scatter(y='mean',label='data 2')*df2.hvplot.errorbars(y='mean',yerr1='eb_min',yerr2='eb_max',color='red',label='data 2'),
]).opts(title='Dark background',width=400)

# Light background plot
plot_light_bg = hv.Overlay([
df1.hvplot.scatter(y='mean',label='data 1')*df1.hvplot.errorbars(y='mean',yerr1='eb_min',yerr2='eb_max',color='cyan',label='data 1'),
df2.hvplot.scatter(y='mean',label='data 2')*df2.hvplot.errorbars(y='mean',yerr1='eb_min',yerr2='eb_max',color='red',label='data 2'),
]).opts(title='Light background',width=400, bgcolor='DarkGrey' )

plot_dark_bg + plot_light_bg
```

#### Screenshots or screencasts of the bug in action
These two plots show the same example data with two different background colors. The "dark" background is the preferred style, but the ends of the errorbars are barely visible. It is necessary to lighten the background color just to see them.

![image](https://github.com/user-attachments/assets/6c3f8395-d0f8-4f0f-a840-d2c5943ae7ad)

This plot shows one curve being dimmed by clicking on the legend. Only the scatter markers are dimmed, not the errorbars.
![image](https://github.com/user-attachments/assets/362304d3-bb60-44b3-b90e-fa801982e9b0)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.