Skip to content
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

Changing color of errorbars #1438

Open
redlegjed opened this issue Oct 11, 2024 · 0 comments
Open

Changing color of errorbars #1438

redlegjed opened this issue Oct 11, 2024 · 0 comments

Comments

@redlegjed
Copy link

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

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

This plot shows one curve being dimmed by clicking on the legend. Only the scatter markers are dimmed, not the errorbars.
image

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

No branches or pull requests

1 participant