Search code examples
holoviews

Dimension value_format callback not working properly


This is a new question related to a previous question I asked: holoviews can't find flexx when using a Dimension value_format callback

Thanks to downgrading my version of flexx, I am no longer getting the warning message. However, the callback function is not working. Here is the code:

%%output size=200
%%opts Curve [width=600 height=250] {+framewise}
%%opts Curve.Load.Ticket (color='red')

def xformat(x):
    # update the default tick label to append an 'a'
    new = x + 'a'
    return(new)

kdims=hv.Dimension('Day Section', label='Week Day and Hour', value_format=xformat)

tload = hv.Curve(simple_pd,vdims=[('Max Ticket Load', 'Maxiumum Ticket Load')],kdims=kdims,group='Load',label='Ticket')
tload

When I run with the above code, I expect to see the same amount of x axis tick labels, however, each label should have an 'a' appended to the end. However, what I am seeing is no rendering of the element at all in my notebook. I have tried a number of variations of modifying the value, and the same thing happens.

screen cap


Solution

  • Strangely, the issue appears to be the use of the variable name new in the xformat function. If I change the name of the variable it works fine. It doesn't appear as though new is a reserved work in python though, so I am not sure why its causing a problem.

    Note that using the matplotlib extension does not have the same problem, only Bokeh.