title: Bokeh: Why does factor_cmap work in vbar but not in line?
body: <p>I have trouble understanding how to map categorical data to colors in bokeh. 
  I create a sample data frame that look like </p>
  
  <pre><code>                   A    B
  2000-01-31  0.357440  baz
  2000-02-29  0.377538  foo
  2000-03-31  1.382338  bar
  2000-04-30  1.175549  baz
  2000-05-31 -0.939276  baz
  2000-06-30 -1.143150  bar
  2000-07-31 -0.542440  baz
  2000-08-31 -0.548708  baz
  2000-09-30  0.208520  bar
  2000-10-31  0.212690  bar
  2000-11-30  1.268021  foo
  2000-12-31 -0.807303  bar
  2001-01-31 -3.303072  bar
  2001-02-28 -0.806650  baz
  2001-03-31 -0.360329  baz
  </code></pre>
  
  <p>Below is an (adapted) minimal example where a bar chart is used and the color is chosen automatically be using <code>factor_cmap</code>:</p>
  
  <pre><code>from bokeh.models import ColumnDataSource
  from bokeh.palettes import Dark2
  from bokeh.plotting import figure, show
  from bokeh.transform import factor_cmap
  import numpy as np
  import pandas.util.testing as pdt
  import random
  
  pdt.N, pdt.K = 15, 1  # Module-level default rows/columns
  np.random.seed(444)
  
  df = pdt.makeTimeDataFrame(freq='M')
  
  #random.choices(['foo', 'bar', 'baz'], k=len(df))
  df['B'] = random.choices(['foo', 'bar', 'baz'], k=df.index.size)
  
  source = ColumnDataSource(df)
  
  cmap = factor_cmap('B', Dark2[3], ['foo', 'bar', 'baz'])
  
  p = figure(x_axis_type='datetime')
  p.vbar(x='index', top='A', width=0.7, color=cmap, line_width=2, source=source)
  show(p)
  </code></pre>
  
  <p>However, if I try to do <em>the same thing</em> with a line chart</p>
  
  <pre><code>p = figure(x_axis_type='datetime')
  p.line(x='index', y='A', color=cmap, line_width=2, source=source)
  show(p)
  </code></pre>
  
  <p>I get the following value error</p>
  
  <pre><code>ValueError: expected an element of either Enum('aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'), Regex('^#[0-9a-fA-F]{6}$'), Regex('^rgba\\(((25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d\\d?)\\s*,\\s*?){2}(25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d\\d?)\\s*,\\s*([01]\\.?\\d*?)\\)'), Regex('^rgb\\(((25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d\\d?)\\s*,\\s*?){2}(25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d\\d?)\\s*?\\)'), Tuple(Byte(Int, 0, 255), Byte(Int, 0, 255), Byte(Int, 0, 255)), Tuple(Byte(Int, 0, 255), Byte(Int, 0, 255), Byte(Int, 0, 255), Percent) or RGB, got {'field': 'B', 'transform': CategoricalColorMapper(id='3465', ...)}
  </code></pre>
  
  <p>Where did I go wrong here?</p>
  
  <p>I can workaround that by creating a pivot table on the values of <code>'B'</code> and plotting a line for each value. The expected output would be something like this
  <a href="https://i.stack.imgur.com/iborZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iborZ.png" alt="enter image description here"></a></p>
  
  <p>However, I need to specifiy every single value and every single color by hand and this will break down every single time the unique values change.</p>