Drawing Data With Glyphs
An empty figure isn’t all that exciting, so in this video you will explore glyphs: the building blocks of Bokeh visualizations. A glyph is a vectorized graphical shape or marker that is used to represent your data.
A Few Categories of Glyphs:
- Marker: Shapes like circles, diamonds, squares and triangles. Effective for scatter and bubble charts.
- Line: Single, step and multi-line shapes. For building line charts.
- Bar/Rectangle: Traditional or stacked bar (hbar) and column (vbar) charts as well as waterfall or gantt charts.
# Bokeh Libraries from bokeh.io import output_file from bokeh.plotting import figure, show # My x-y coordinate data x = [1, 2, 1] y = [1, 1, 2] # Output the visualization to a static HTML file - first_glyphs.html output_file('first_glyphs.html', title='First Glyphs') # Create a figure with no toolbar and axis ranges [0, 3] fig = figure(title='My Coordinates', plot_height=300, plot_width=300, x_range=(0, 3), y_range=(0, 3), toolbar_location=None) # Draw the coordinate as circles fig.circle(x=x, y=y, color='green', size=10, alpha=0.5) # Show plot show(fig)
Become a Member to join the conversation.