Hi everyone, I’ve found a lot online about using legends with circle() but not Circle()
I am currently plotting two different data sources like so:
boda_source = ColumnDataSource(dict(boda_id = locations["boda"]["id"],
boda_x = locations["boda"]["x"],
boda_y = locations["boda"]["y"],
boda_lon = locations["boda"]["longitude"],
boda_lat = locations["boda"]["latitude"]
))
static_source = ColumnDataSource(dict(static_id = locations["static"]["id"],
static_x = locations["static"]["x"],
static_y = locations["static"]["y"],
static_lon = locations["static"]["longitude"],
static_lat = locations["static"]["latitude"]))
# Hover tools
boda_hover = HoverTool(names=["boda"],
tooltips = [("Type", "Mobile"),
("Sensor ID", "@boda_id"),
("Lat/long", "@boda_lat, @boda_lon")])
static_hover = HoverTool(names=["static"],
tooltips = [("Type", "Static"),
("Sensor ID", "@static_id"),
("Lat/long", "@static_lat, @static_lon")])
# Plot figure and add tiles
mapv2 = figure(title=None,
x_range=(mercx0[0], mercxend[0]),
y_range=(mercy0[0], mercyend[0]),
x_axis_type="mercator",
y_axis_type="mercator",
tools = ["pan,wheel_zoom,box_zoom,reset", boda_hover, static_hover])
mapv2.add_tile(tile_provider)
# Create and plot glyphs for predictions
boda_glyph = Circle(x="boda_x", y="boda_y", size= 10, line_color="white", fill_color="green", fill_alpha=0.8, line_width=1,
line_alpha=1)
static_glyph = Circle(x="static_x", y="static_y", size= 10, line_color="white", fill_color="red", fill_alpha=0.8, line_width=1,
line_alpha=1)
mapv2.add_glyph(boda_source, boda_glyph, name="boda")
mapv2.add_glyph(static_source, static_glyph, name="static")
But I can’t work out how to get legends to work with the glyphs if I’m not just adding markers directly.