Bokeh Tutorial
Selected Reading
- Bokeh - Discussion
- Bokeh - Useful Resources
- Bokeh - Quick Guide
- Bokeh - Developing with JavaScript
- Bokeh - WebGL
- Bokeh - Extending Bokeh
- Bokeh - Embedding Plots and Apps
- Bokeh - Exporting Plots
- Bokeh - Using Bokeh Subcommands
- Bokeh - Server
- Bokeh - Adding Widgets
- Bokeh - Customising legends
- Bokeh - Styling Visual Attributes
- Bokeh - Plot Tools
- Bokeh - Layouts
- Bokeh - Filtering Data
- Bokeh - ColumnDataSource
- Bokeh - Pandas
- Bokeh - Annotations and Legends
- Bokeh - Axes
- Bokeh - Setting Ranges
- Bokeh - Specialized Curves
- Bokeh - Wedges and Arcs
- Bokeh - Rectangle, Oval and Polygon
- Bokeh - Circle Glyphs
- Bokeh - Area Plots
- Bokeh - Plots with Glyphs
- Bokeh - Basic Concepts
- Bokeh - Jupyter Notebook
- Bokeh - Getting Started
- Bokeh - Environment Setup
- Bokeh - Introduction
- Bokeh - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Bokeh - Customising legends
Bokeh - Customising legends
Various glyphs in a plot can be identified by legend property appear as a label by default at top-right position of the plot area. This legend can be customised by following attributes −
1 | legend.label_text_font | change default label font to specified font name | |
2 | legend.label_text_font_size | font size in points | |
3 | legend.location | set the label at specified location. | |
4 | legend.title | set title for legend label | |
5 | legend.orientation | set to horizontal (default) or vertical | |
6 | legend.cpcking_popcy | specify what should happen when legend is cpcked hide: hides the glyph corresponding to legend mute: mutes the glyph corresponding to legendtd> |
Example
Example code for legend customisation is as follows −
from bokeh.plotting import figure, output_file, show import math x2 = pst(range(1,11)) y4 = [math.pow(i,2) for i in x2] y2 = [math.log10(pow(10,i)) for i in x2] fig = figure(y_axis_type = log ) fig.circle(x2, y2,size = 5, color = blue , legend = blue circle ) fig.pne(x2,y4, pne_width = 2, pne_color = red , legend = red pne ) fig.legend.location = top_left fig.legend.title = Legend Title fig.legend.title_text_font = Arial fig.legend.title_text_font_size = 20pt show(fig)