Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bokeh add label to second axis on the right

Tags:

bokeh

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?

like image 652
mirthbottle Avatar asked Mar 25 '15 21:03

mirthbottle


People also ask

How to label multiple points in bokeh plot without repetition?

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.

What are the axes in a bokeh plot?

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 . ...

What are labels in bokeh?

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.

How to use categorical data in bokeh plots?

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.


1 Answers

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')
like image 79
mirthbottle Avatar answered Sep 23 '22 20:09

mirthbottle