Transformations VI

from lesson 03_Data_ Sources_&_Transformations

The text says:

Change the code above to use log_cmap and observe the results.

from bokeh.transform import log_cmap

N = 4000
data = dict(x=np.random.random(size=N) * 100,
            y=np.random.random(size=N) * 100,
            r=np.random.random(size=N) * 1.5)

p = figure()

p.circle('x', 'y', radius='r', source=data, fill_alpha=0.6,
        
         # color map based on the x-coordinate
         color=log_cmap('x', 'Viridis256', 0, 100))

show(p) 

The only difference between this one and the one before is swapping log_cmap for linear_cmap, but the result could not be more different:

There are no errors or exceptions.
I don’t get it. What happened here? What was I supposed to do differently?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.