-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
Expected Behavior:
When the source data contain a mixture of positive and negative values, the bars with negative values will stack downward below 0 without interfering the positive bars.
Observed Behavior:
When the source data contain a mixture of positive and negative values, the bars with negative values stack downward from the top of the previous positive bar, making that bar not visible.
Note: This is similar to the issue raised in plotly , and this is resolved by having a 'relative' barmode.
Software versions:
bokeh 1.2.0
Python 3.6.8
OS:
Windows 10
Example:
from bokeh.plotting import figure, show, save
from bokeh.io import output_notebook
from bokeh.core.properties import value
from bokeh.layouts import *
y_s = ['y1', 'y2']
data = {'x_values': [1, 2, 3, 4, 5],
'y1': [-2, 5, 1, -2, 3],
'y2': [1, -9, -5, 1, -2]}
p = figure(title="Demonstration")
p.vbar_stack(['y1', 'y2'], x='x_values', width = 0.5, color = ['blue','red'], source = data, legend=[value(y) for y in y_s])
p.legend.click_policy="hide"
show(p)
Expected Output:
Although using separate vbar glyphs can solve the issue in this example, it will not be much help when there are more stacked bars and the data gets more complicated.