import datashader as ds import datashader.transfer_functions as tf from datashader import spatial from colorcet import fire %%time df = spatial.read_parquet('./data/osm-1billion.parq') df = df.persist() print(len(df)) df.head() bound = 20026376.39 bounds = dict(x_range = (-bound, bound), y_range = (int(-bound*0.4), int(bound*0.6))) plot_width = 900 plot_height = int(plot_width*0.5) %%time cvs = ds.Canvas(plot_width=plot_width, plot_height=plot_height, **bounds) agg2=cvs.points(df, 'x', 'y', ds.count()) %%time cvs = ds.Canvas(plot_width=plot_width, plot_height=plot_height, **bounds) agg = cvs.points(df, 'x', 'y', ds.count()) tf.shade(agg, cmap=["lightblue", "darkblue"], how='log') tf.shade(agg.where(agg > 15), cmap=["lightblue", "darkblue"]) tf.set_background(tf.shade(agg.where(agg > 15), cmap=fire),"black") import holoviews as hv from holoviews import opts from holoviews.operation.datashader import datashade, dynspread hv.extension('bokeh') rgb_opts = opts.RGB(width=plot_width,height=plot_height, xaxis=None, yaxis=None, bgcolor="black") points = hv.Points(df, ['x', 'y']).redim.range(x=bounds["x_range"],y=bounds["y_range"]) rgb = dynspread(datashade(points, cmap=["darkblue", "lightcyan"], width=plot_width,height=plot_height)) rgb.opts(rgb_opts)