ploting sparse data

I am plotting a line where :

x axis is Timestamp. eg. T1, T2, -> T20

y axis is a Stat Value eg. … … … 10 20 30

… indicates that there is no value for the stat for that timestamp.

The line is plotted using this call:

            figure.line (x_axis, this_bucket_plot, legend=bucket, alpha=0.5, color=this_color, line_width=3)

x_axis is an array of x axis datapoints
this_bucket_plot is an array of y axis datapoints.

Most of the datapoints in this_bucket_plot as intentionally set to 0 so that lenght of both arrays is same.
To save processing time, is there a way to indicate bokeh not to plot 0 values. Most of my data is sparse i.e. 0.

Hi,

There are certainly ways to do this on the client side with CustomJSTransform, etc. but if the goal is to not send the data in the first place, then you should cut the data down first on the python side. Something like:

  In [1]: import numpy as np
  
  In [2]: x = np.arange(10)
  
  In [3]: y = np.zeros_like(x)
  
  In [4]: y[1] = 1; y[4:7] = 1
  
  In [5]: x
  Out[5]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
  
  In [6]: y
  Out[6]: array([0, 1, 0, 0, 1, 1, 1, 0, 0, 0])
  
  In [7]: x[y>0]
  Out[7]: array([1, 4, 5, 6])
  
  In [8]: y[y>0]
  Out[8]: array([1, 1, 1, 1])

Thanks,

Bryan

···

On May 23, 2018, at 12:46, [email protected] wrote:

I am plotting a line where :

x axis is Timestamp. eg. T1, T2, -> T20
y axis is a Stat Value eg. .. .. .. 10 20 30

.. indicates that there is no value for the stat for that timestamp.

The line is plotted using this call:
figure.line (x_axis, this_bucket_plot, legend=bucket, alpha=0.5,
            color=this_color, line_width=3)

x_axis is an array of x axis datapoints
this_bucket_plot is an array of y axis datapoints.

Most of the datapoints in this_bucket_plot as intentionally set to 0 so that lenght of both arrays is same.
To save processing time, is there a way to indicate bokeh not to plot 0 values. Most of my data is sparse i.e. 0.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/46363223-f8e9-4e4c-810e-57f5d7620a13%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.