Python bokeh bar chart with nominal / categorical x-axis + twin y-axis
<p>How can I create a plot with bokeh that is a Bar chart and has left and right <code>y-axis</code>? I want to plot two columns from a dataframe, where the row ID is categorical and it should be the <code>x-axis</code>. Wint only one <code>y-axis</code>, <code>Bar</code> works well but I don't know how to add <code>extra_y_ranges</code> to a Bar chart or better to say I can create <code>extra_y_ranges</code> but I cannot use <code>add_layout</code> at Bar chart. And I cannot plot my dataframe columns in the way that the first column would relate to the left <code>y-axis</code> and the second column would relate to the right <code>y-axis</code>.</p>

<p>I tried to create bar chart manually with <code>figure.quad</code>. I had to use <code>x_range=my_df.index</code> because I need categorical <code>x-axis</code>. I use the same values at <code>left</code> and <code>right</code> parameters and I use <code>line_width=7</code> not to have a single line but a bar. But I have to shift my bars a bit to left becasue I want to plot my second attribute on the same categorical IDs.
So my question is: How can I shift a plot to left/right?</p>

<p>Here is a sample example what I do:</p>

<pre><code>from bokeh.plotting import figure, output_file, show
from bokeh.models import LinearAxis, Range1d

output_file("bars.html")

p = figure(title="twin y-axis bar example", x_range=['0','4','2'])

p.quad(bottom=0, top=[70,60,50], left=['0','4','2'], right=['0','4','2']
    , line_width=7, line_color='red')

p.extra_y_ranges = {'foo':Range1d(start=0, end=20)}
p.add_layout(LinearAxis(y_range_name='foo', axis_label='right_y_axis'), place='right')

p.quad(bottom=0, top=[15,10,5], left=['0','4','2'], right=['0','4','2']
    , line_width=7, line_color='blue', y_range_name='foo')

show(p)
</code></pre>

<p>So I want to shift a bit left the red bar and a bit right the blue bar not to cover each other.</p>

<p>Thank you!!!</p>