ds.Canvas has no axis options


I am following examples of “plotting large numbers of time series together” section. All of them has no axis. And ds.Canvas doc only has the option of log scale. But there is anyway to print y axis?


Datashader itself has no axis plotting; all it does is render data into an array. Are you asking, given that I can see other plots on that page that have axes, how can I do that specifically for the “plotting large numbers of time series together” example? If so, it’s just a matter of adapting that example to use HoloViews or another way of visualizing data with a plotting library, as in those other examples. If you have a large number of time series that you do want to plot together in some useful way and can share the data, I’d be happy to adapt that example to show how to do it with HoloViews and make it into one of the examples we share at examples.pyviz.org.

I just would like to see the y scale. I am a “bokeh guy”. I haven’t used holoviz at all, so when I saw the code os plote multiple lines I thought it wasn’t necessary. From now, I now it only plots lines.

This is my example.

import datashader as ds
import datashader.transfer_functions as tf
from datashader.colors import inferno, Greys9, Hot

time = np.linspace(0, 1, cTr.shape[1])
y_range = (pd.concat([cSs,cTr]).min().min(), pd.concat([cSs,cTr]).max().max())
cvs = ds.Canvas(plot_height=400, plot_width=1000, 
                y_range=(y_range[0], y_range[1]) )
agg = cvs.line(cSs, \
               x = time, y = list(range( cSs.shape[1])), \
               agg = ds.count(), \
               axis = 1)

img = tf.shade(agg,cmap = inferno,how='eq_hist')
agg2 = cvs.line(cTr, \
                x = time, y = list(range( cTr.shape[1])), \
                agg = ds.count(), \
                axis = 1)

img = img + tf.shade(agg2, \
                     cmap=["white", 'darkblue'], \

And here are both datasets:

Y wanted to do these things:

  • 1 - Have y axis values. Even background lines and so on…

  • 2 - I have tried other tricky thing with very bad results. Yo can see, in the code, typical colors cmap I’ve added. But previoulsy I tried to do something very interesting:

    For me every time-series are the different result I get from an original unique time-series every time step ahead. The point is, I’d like change color gradually for each time series. I mean, time-series[0] with color[0],time-series[1] with color[1] and so on… I tried to do this with this code:

    def categorical_color_key(ncats,cmap):
    mapper = get_cmap(cmap)
    return [str(rgb2hex(mapper(i))) for i in np.linspace(0, 1, ncats)]

And replacing this lines in my original plotting code:

    #cmap=["white", 'darkblue'], \
    color_key = categorical_color_key(len(cepSs),'viridis'), \

But I don’t get expected results. Is like doing nothing.