

Stretch_width: If a height but neither a width or aspect are defined the plot will stretch to fill all available horizontal space. Stretch_both: If neither a width, height or aspect are defined the plot will stretch to fill all available space. Scaling ensures that the aspect ratio of the plot is maintained. Scale_both: If neither a width or a height are defined but a fixed aspect is defined both axes will be scaled up to the maximum size of the container.

This leaves four different responsive modes: when width and height or width and aspect are set the plot is set to a fixed size, ignoring any responsive option. Specifically responsive mode will only work if at least one dimension of the plot is left undefined, e.g. If enabled, the behavior of responsive modes depends on whether an aspect or width/height option is set. Since bokeh plots are rendered within a browser window which can be resized dynamically it supports responsive sizing modes allowing the plot to rescale when the window it is placed in is changed. In particular, the specified size includes the axes and any legends or colorbars. This is the default behavior and makes it easy to achieve precise alignment between plots but does not allow for keeping a constant aspect or responsive resizing. The most straightforward approach to specifying the size of a plot is using a width and height specified in pixels. In this section we will discover the different approaches to setting plot dimensions and aspects.

The sizing is determined by the combination of width, height, aspect and responsive options. Each subplot can be sized independently and it will fill the allocated space. In the bokeh backend the sizing of plots and specifically layouts of plots is determined in an inside-out or compositional manner. If you’re unsure, simply input your best guess and it’ll try to provide a list of suggestions if there’s an issue. Some examples include legend, colorbar, xaxis, yaxis, and much, much more. With knowledge of the attributes of Bokeh, it’s possible to configure many other plot components besides toolbar. Notice how much more concise it is with backend_opts! Here’s an example of HoloViews Elements using a Bokeh backend, with bokeh’s style options: Note also that most of these options support vectorized style mapping as described in the Style Mapping user guide. For example let us convert a HoloViews Image to a bokeh Figure, which will let us access and modify every aspect of the plot: If at any time you need access to the underlying Bokeh representation of an object you can use the hv.render function to convert it.

When HoloViews outputs bokeh plots it creates and manipulates bokeh models in the background. The general principles behind customizing plots and styling the visual elements of a plot are covered in the Style Mapping and Customizing Plots user guides. This user guide will cover various interactive features that bokeh provides which is not covered by the more general user guides, including interactive tools, linked axes and brushing and more. By combining the ease of generating interactive, high-dimensional visualizations with the interactive widgets and fast rendering provided by Bokeh, HoloViews becomes even more powerful. Bokeh provides a powerful platform to generate interactive plots using HTML5 canvas and WebGL, and is ideally suited towards interactive exploration of data. One of the major design principles of HoloViews is that the declaration of data is completely independent from the plotting implementation.
