I am creating a bar chart using Bokeh, and I want to display 2 independent sets of data. I have added another y-axis to the right side of my plot using the following
bar2.extra_y_ranges = {"Mtons": Range1d(start=0, end=2000)}
bar2.add_layout(LinearAxis(y_range_name="Mtons"), 'right')
How do I add a label for the second axis?
But if we want to label all the points, then there is no point in repeating the code every time. So, in such a situation, bokeh has come up with a package known as LabelSet that helps us to label multiple points in the plot without repetition.In this example, we will be using another package i.e ColumnDataSource.
Bokeh - Axes Sr.No Axes Description 1 Categorical Axes The bokeh plots show numerical data alon ... 2 Log Scale Axes If there exists a power law relationship ... 3 Twin Axes It may be needed to show multiple axes . ...
In this article, we will be learning about Labels in Bokeh. Labels are the short words or phrases that are used in order to define something in a plot. Let us take an example that we are plotting a set of points in a graph.
The bokeh plots show numerical data along both x and y axes. In order to use categorical data along either of axes, we need to specify a FactorRange to specify categorical dimensions for one of them. If there exists a power law relationship between x and y data series, it is desirable to use log scales on both axes.
LinearAxis
has a parameter axis_label
. This can be set by editing the call to LinearAxis
as follows:
bar2.add_layout(LinearAxis(y_range_name="Mtons", axis_label="Mt CO2e"), 'right')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With