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

colorbar=True is missing text values when logz=True #2606

Closed
jbednar opened this issue Apr 23, 2018 · 7 comments
Closed

colorbar=True is missing text values when logz=True #2606

jbednar opened this issue Apr 23, 2018 · 7 comments
Labels
tag: backend: bokeh type: bug Something isn't correct or isn't working
Milestone

Comments

@jbednar
Copy link
Member

jbednar commented Apr 23, 2018

I can enable a colorbar for a logz plot, but it doesn't show any numbers, making it not be very useful:

import numpy as np, pandas as pd, holoviews as hv
hv.extension('bokeh')

url     = 'https://raw.githubusercontent.com/blmoore/blogR/master/data/measles_incidence.csv'
data    = pd.read_csv(url, skiprows=2, na_values='-')
yearly  = data.drop('WEEK', axis=1).groupby('YEAR').sum().reset_index()
measles = pd.melt(yearly, id_vars=['YEAR'], var_name='State', value_name='Incidence')

heatmap = hv.HeatMap(measles, label='Measles Incidence').options( \
    height=500, tools=['hover'], logz=True, invert_yaxis=True, labelled=[], 
    toolbar='above', xaxis=None, colorbar=True)

heatmap.opts(plot=dict(width=900))

image

Works fine without logz:

image

@jlstevens jlstevens added the type: bug Something isn't correct or isn't working label Apr 23, 2018
@philippjfr
Copy link
Member

This is specifically because the lower bound of the range is zero which is not supported by the log colormapper.

@jlstevens
Copy link
Contributor

Maybe this could show a warning in this case? Taking the log of zero is a reasonable thing to complain about...

@jlstevens
Copy link
Contributor

I assume there is code to drop the labels for all invalid values, e.g negative logs as well. Maybe a warning show up for any such invalid condition..

@jbednar
Copy link
Member Author

jbednar commented Apr 23, 2018

Presumably there is code elsewhere to deal with the zero values, or else logz=True itself should fail on this plot, both when choosing the colors for the main plot and when making the colorbar itself. Having it fail only when displaying the numerical values is odd.

@jlstevens
Copy link
Contributor

Having it fail only when displaying the numerical values is odd.

Good point. Whatever is being displayed with the colormap should have the corresponding value shown. I'm not sure how I would interpret log values when the data falls below 1 to be honest...

@jbednar
Copy link
Member Author

jbednar commented Apr 23, 2018

I assume it's using log1p, so the colorbar labelling can just do the same.

@jbednar
Copy link
Member Author

jbednar commented Jul 7, 2018

Looks like this is a problem in Bokeh, not HoloViews: bokeh/bokeh#8061

@philippjfr philippjfr added this to the v1.10.8 milestone Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: backend: bokeh type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

3 participants