class NYCTaxiExplorer(hv.streams.Stream): alpha = param.Magnitude(default=0.75, doc="Alpha value for the map opacity") colormap = param.ObjectSelector( default=cm["fire"], objects=[cm[k] for k in cm.keys() if not '_' in k]) hour = param.Range(default=(0, 24), bounds=(0, 24)) location = param.ObjectSelector(default='dropoff', objects=['dropoff', 'pickup']) def make_view(self, x_range, y_range, **kwargs): map_tiles = tiles(style=dict(alpha=self.alpha), plot=tile_options) points = hv.Points(df, kdims=[self.location + '_x', self.location + '_y'], vdims=['dropoff_hour']) if self.hour != (0, 24): points = points.select(dropoff_hour=self.hour) taxi_trips = datashade(points, x_sampling=1, y_sampling=1, cmap=self.colormap, dynamic=False, x_range=x_range, y_range=y_range, width=1000, height=600) return map_tiles * taxi_trips
class NYCTaxiExplorer(hv.streams.Stream): alpha = param.Magnitude(default=0.75, doc="Alpha value for the map opacity") colormap = param.ObjectSelector( default=cm["fire"], objects=[cm[k] for k in cm.keys() if not '_' in k]) plot = param.ObjectSelector(default="pickup", objects=["pickup", "dropoff"]) passengers = param.Range(default=passenger_counts, bounds=passenger_counts) output = parambokeh.view.Plot() def make_view(self, x_range, y_range, alpha, colormap, plot, passengers, **kwargs): map_tiles = tiles(style=dict(alpha=alpha), plot=tile_options) points = hv.Points(df, kdims=[plot + '_x', plot + '_y'], vdims=['passenger_count']) if passengers != passenger_counts: points = points.select(passenger_count=passengers) taxi_trips = datashade(points, x_sampling=1, y_sampling=1, cmap=colormap, dynamic=False, x_range=x_range, y_range=y_range) return map_tiles * taxi_trips
class NYCTaxiExplorer(hv.streams.Stream): alpha = param.Magnitude(default=0.75, doc="Alpha value for the map opacity") colormap = param.ObjectSelector( default=cm["fire"], objects=[cm[k] for k in cm.keys() if not '_' in k]) hour = param.Integer(default=None, bounds=(0, 23), doc="All hours by default; drag to select one hour") passengers = param.Range(default=(0, max_pass), bounds=(0, max_pass)) location = param.ObjectSelector(default='dropoff', objects=['dropoff', 'pickup']) def make_view(self, x_range, y_range, **kwargs): map_tiles = tiles.opts(style=dict(alpha=self.alpha), plot=options) points = hv.Points(df, kdims=[self.location + '_x', self.location + '_y'], vdims=[self.location + '_hour']) selection = { self.location + "_hour": self.hour if self.hour else (0, 24), "passenger_count": self.passengers } taxi_trips = datashade(points.select(**selection), x_sampling=1, y_sampling=1, cmap=self.colormap, dynamic=False, x_range=x_range, y_range=y_range, width=1000, height=600) return map_tiles * taxi_trips
class ColormapPicker(hv.streams.Stream): colormap = param.ObjectSelector(default=cm["fire"], objects=[cm[k] for k in cm.keys() if not '_' in k])
class ColormapPicker(hv.streams.Stream): # set up the colormap picker colormap = param.ObjectSelector( default=cm["kbc"], objects=[cm[k] for k in cm.keys() if not '_' in k])
class ColormapPicker(hv.streams.Stream): colormap = param.ObjectSelector( default=cm["bgy"], # sets the default colormap to "blues" objects=[cm[k] for k in cm.keys() if not '_' in k])