Repository: bokeh/bokeh

Issue:
ColorBar - setting outline_line_alpha=0 on Plot causes bar to not appear
This is very odd, but the axes appear but the colorbar doesn't.

Sorry, don't have any sample code.



Discussion:
ping @canavandl 

I'm unable to reproduce with:

``` python
from bokeh.plotting import figure, show, output_file
from bokeh.models import ColorBar, LinearColorMapper, Plot, Range1d, LinearAxis

output_file('outline.html')

mapper = LinearColorMapper(palette='Spectral8', low=0, high=10)

cbar = ColorBar(color_mapper=mapper, orientation='vertical',
                location=(0,0))

p = Plot(x_range=Range1d(0,1), y_range=Range1d(0,1),
         plot_width=500, plot_height=500, toolbar_location=None)
p.outline_line_color=None

p.add_layout(LinearAxis(), 'left')
p.add_layout(LinearAxis(), 'below')

p.add_layout(cbar, 'right')

show(p)
```

<img width="522" alt="screen shot 2016-08-22 at 12 41 04 pm" src="https://cloud.githubusercontent.com/assets/2198981/17864979/f46cf5ac-6865-11e6-89d1-5c2419bff1f7.png">

Are you sure you're setting the location properly? The default location is "top_right", but if you stick the ColorBar in a side panel, you have to set the location to `(0,0)`.

Sorry, here's some working code - it's `outline_line_alpha=0` is the problem.

~~Interestingly it also causes the axes to disappear.~~

``` python
from bokeh.io import show
from bokeh.models import ColorBar, LinearColorMapper, Plot, Range1d, LinearAxis

mapper = LinearColorMapper(palette='Spectral8', low=0, high=10)
cbar = ColorBar(color_mapper=mapper, orientation='vertical', location=(0, 0))

p = Plot(
    x_range=Range1d(0, 1),
    y_range=Range1d(0, 1),
    toolbar_location=None,
    outline_line_alpha=0,
)
p.add_layout(LinearAxis(), 'left')
p.add_layout(LinearAxis(), 'below')

p.add_layout(cbar, 'right')

show(p)
```

It doesn't cause axes to disappear - my mistake - here's a screenshot with the alpha set to 0.1:

<img width="631" alt="screen shot 2016-08-22 at 1 07 04 pm" src="https://cloud.githubusercontent.com/assets/1796208/17869712/617674cc-6869-11e6-9c1b-62dfdeaca8d1.png">


Resolving patch:
diff --git a/bokeh/models/annotations.py b/bokeh/models/annotations.py
--- a/bokeh/models/annotations.py
+++ b/bokeh/models/annotations.py
@@ -151,6 +151,10 @@ class ColorBar(Annotation):
     The width (in pixels) that the rendered legend should occupy.
     """)
 
+    scale_alpha = Float(1.0, help="""
+    The alpha with which to render the color scale.
+    """)
+
     title = String(help="""
     The title text to render.
     """)


Test patch:
diff --git a/bokeh/models/tests/test_annotations.py b/bokeh/models/tests/test_annotations.py
--- a/bokeh/models/tests/test_annotations.py
+++ b/bokeh/models/tests/test_annotations.py
@@ -54,6 +54,7 @@ def test_ColorBar():
     assert color_bar.orientation == 'vertical'
     assert color_bar.legend_height == 'auto'
     assert color_bar.legend_width == 'auto'
+    assert color_bar.scale_alpha == 1.0
     assert color_bar.title is None
     assert color_bar.title_standoff == 2
     assert isinstance(color_bar.ticker, BasicTicker)
@@ -81,6 +82,7 @@ def test_ColorBar():
         "orientation",
         "legend_height",
         "legend_width",
+        "scale_alpha",
         "title",
         "title_standoff",
         "ticker",
diff --git a/tests/integration/annotations/screenshots/base__test_color_bar__test_color_bar_with_scale_alpha.png b/tests/integration/annotations/screenshots/base__test_color_bar__test_color_bar_with_scale_alpha.png
new file mode 100644
Binary files /dev/null and b/tests/integration/annotations/screenshots/base__test_color_bar__test_color_bar_with_scale_alpha.png differ
diff --git a/tests/integration/annotations/test_color_bar.py b/tests/integration/annotations/test_color_bar.py
--- a/tests/integration/annotations/test_color_bar.py
+++ b/tests/integration/annotations/test_color_bar.py
@@ -64,3 +64,22 @@ def test_color_bar_placement_and_render(output_file_url, selenium, screenshot):
 
     # Take screenshot
     assert screenshot.is_valid()
+
+@pytest.mark.screenshot
+def test_color_bar_with_scale_alpha(output_file_url, selenium, screenshot):
+    plot = Plot(height=HEIGHT, width=WIDTH,
+                x_range=Range1d(0,10), y_range=Range1d(0,10),
+                outline_line_alpha=0.0, toolbar_location=None)
+
+    bar_vertical_in_frame = create_vertical_color_bar_with_log_cmap()
+    bar_vertical_in_frame.scale_alpha = 0.5
+
+    plot.add_layout(bar_vertical_in_frame)
+
+    # Save the plot and start the test
+    save(plot)
+    selenium.get(output_file_url)
+    assert has_no_console_errors(selenium)
+
+    # Take screenshot
+    assert screenshot.is_valid()