{"action":"created","issue":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/2622","labels_url":"https://api.github.com/repos/bokeh/bokeh/issues/2622/labels{/name}","comments_url":"https://api.github.com/repos/bokeh/bokeh/issues/2622/comments","events_url":"https://api.github.com/repos/bokeh/bokeh/issues/2622/events","html_url":"https://github.com/bokeh/bokeh/issues/2622","id":97512177,"number":2622,"title":"List of color tuples broken?","user":{"login":"jmhessel","id":178075,"avatar_url":"https://avatars.githubusercontent.com/u/178075?v=3","gravatar_id":"","url":"https://api.github.com/users/jmhessel","html_url":"https://github.com/jmhessel","followers_url":"https://api.github.com/users/jmhessel/followers","following_url":"https://api.github.com/users/jmhessel/following{/other_user}","gists_url":"https://api.github.com/users/jmhessel/gists{/gist_id}","starred_url":"https://api.github.com/users/jmhessel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmhessel/subscriptions","organizations_url":"https://api.github.com/users/jmhessel/orgs","repos_url":"https://api.github.com/users/jmhessel/repos","events_url":"https://api.github.com/users/jmhessel/events{/privacy}","received_events_url":"https://api.github.com/users/jmhessel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bokeh/bokeh/labels/type:%20bug","name":"type: bug","color":"C02942"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/bokeh/bokeh/milestones/11","html_url":"https://github.com/bokeh/bokeh/milestones/short-term","labels_url":"https://api.github.com/repos/bokeh/bokeh/milestones/11/labels","id":811343,"number":11,"title":"short-term","description":"Collects issues that need to be resolved soon, but not before the next release.\r\nThis milestone is always open and it gets populated from the either the long-term milestone or from new (unmilestoned) issues.\r\n\r\nRef: https://github.com/ContinuumIO/bokeh/wiki/BEP-1:-Issues-and-PRs-management#issue-times","creator":{"login":"damianavila","id":1640669,"avatar_url":"https://avatars.githubusercontent.com/u/1640669?v=3","gravatar_id":"","url":"https://api.github.com/users/damianavila","html_url":"https://github.com/damianavila","followers_url":"https://api.github.com/users/damianavila/followers","following_url":"https://api.github.com/users/damianavila/following{/other_user}","gists_url":"https://api.github.com/users/damianavila/gists{/gist_id}","starred_url":"https://api.github.com/users/damianavila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianavila/subscriptions","organizations_url":"https://api.github.com/users/damianavila/orgs","repos_url":"https://api.github.com/users/damianavila/repos","events_url":"https://api.github.com/users/damianavila/events{/privacy}","received_events_url":"https://api.github.com/users/damianavila/received_events","type":"User","site_admin":false},"open_issues":245,"closed_issues":30,"state":"open","created_at":"2014-10-02T12:30:03Z","updated_at":"2015-07-27T18:28:07Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-07-27T17:18:22Z","updated_at":"2015-07-28T00:36:16Z","closed_at":null,"body":"I think that bokeh doesn't properly support lists of colors at the moment.\r\n\r\n````                                         \r\nfrom bokeh.plotting import figure, show, output_file\r\n\r\noutput_file(\"broken.html\")\r\nxs = [1,2,3]\r\nys = [1,2,3]\r\ncol = [(255, 0, 0), (0, 255, 0), (0, 0, 255)]\r\n\r\np = figure(title = \"Broken\")\r\np.circle(xs, ys, radius=.25, color=col)\r\nshow(p)\r\n````\r\n\r\nWhen I run this code, I get 3 circles with no color. The documentation seems to suggest that colors can be passed in this way.\r\n\r\nbokeh.__version__ is 0.9.2"},"comment":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/comments/125389049","html_url":"https://github.com/bokeh/bokeh/issues/2622#issuecomment-125389049","issue_url":"https://api.github.com/repos/bokeh/bokeh/issues/2622","id":125389049,"user":{"login":"canavandl","id":2198981,"avatar_url":"https://avatars.githubusercontent.com/u/2198981?v=3","gravatar_id":"","url":"https://api.github.com/users/canavandl","html_url":"https://github.com/canavandl","followers_url":"https://api.github.com/users/canavandl/followers","following_url":"https://api.github.com/users/canavandl/following{/other_user}","gists_url":"https://api.github.com/users/canavandl/gists{/gist_id}","starred_url":"https://api.github.com/users/canavandl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/canavandl/subscriptions","organizations_url":"https://api.github.com/users/canavandl/orgs","repos_url":"https://api.github.com/users/canavandl/repos","events_url":"https://api.github.com/users/canavandl/events{/privacy}","received_events_url":"https://api.github.com/users/canavandl/received_events","type":"User","site_admin":false},"created_at":"2015-07-28T00:36:16Z","updated_at":"2015-07-28T00:36:16Z","body":"When you set the color property as a RGB-style tuple, Bokeh (correctly) sets the fill/line_color attrs of the dataspec map as ColorSpec instances that get serialized to CSS-style RGB strings in JSON, like:\r\n```javascript\r\n...\r\n {'attributes': {'doc': None,\r\n   'fill_alpha': {'value': 1.0},\r\n   'fill_color': {'value': 'rgb(5, 3, 77)'},\r\n   'id': '2e4667b9-f6ad-4c7d-baa6-f20e054bc92f',\r\n   'line_alpha': {'value': 1.0},\r\n   'line_color': {'value': 'rgb(5, 3, 77)'},\r\n   'radius': {'units': 'data', 'value': 0.25},\r\n   'tags': [],\r\n   'x': {'field': 'x'},\r\n   'y': {'field': 'y'}},\r\n  'id': '2e4667b9-f6ad-4c7d-baa6-f20e054bc92f',\r\n  'type': 'Circle'},\r\n...\r\n```\r\nHowever, when setting a glyph property as a sequence (i.e. x, y, or color), the RGB-style list gets set as a named column in the plot's ColumnDataSource and the fill/line_color attrs get set as the keys. This is a problem because the 3-element lists don't correspond to CSS colors when the plots are rendered on the client.\r\n\r\n```javascript\r\n...\r\n{'attributes': {'callback': None,\r\n   'column_names': ['y', 'x', 'line_color', 'fill_color'],\r\n   'data': {'fill_color': [[255, 0, 0], [0, 255, 0], [0, 0, 255]],\r\n    'line_color': [[255, 0, 0], [0, 255, 0], [0, 0, 255]],\r\n    'x': [1, 2, 3],\r\n    'y': [1, 2, 3]},\r\n   'doc': None,\r\n   'id': 'bbe768fc-f22d-4be0-b2ad-57f8e69d9040',\r\n   'selected': {'0d': {'flag': False, 'indices': []},\r\n    '1d': {'indices': []},\r\n    '2d': {'indices': []}},\r\n   'tags': []},\r\n  'id': 'bbe768fc-f22d-4be0-b2ad-57f8e69d9040',\r\n  'type': 'ColumnDataSource'},\r\n {'attributes': {'doc': None,\r\n   'fill_alpha': {'value': 1.0},\r\n   'fill_color': {'field': 'fill_color'},\r\n   'id': '4a5ab396-9ae5-475c-8640-dc820fdfac97',\r\n   'line_alpha': {'value': 1.0},\r\n   'line_color': {'field': 'line_color'},\r\n   'radius': {'units': 'data', 'value': 0.25},\r\n   'tags': [],\r\n   'x': {'field': 'x'},\r\n   'y': {'field': 'y'}},\r\n  'id': '4a5ab396-9ae5-475c-8640-dc820fdfac97',\r\n  'type': 'Circle'},\r\n... \r\n```\r\nWork arounds include passing lists of CSS-style RGB strings like:\r\n```python\r\ncol = [\"rgb(255, 0, 0)\", \"rgb(0, 255, 0)\", \"rgb(0, 0, 255)\"]\r\n```\r\nor RGB class instances (because their __repr__ is the CSS-style string)\r\n```python\r\nfrom bokeh.colors import RGB\r\ncol = [RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255)]\r\n```\r\nDefinitely, making the docs more explicit about styling colors is needed.\r\n\r\nCode changes:\r\nIt'd be possible to check the color property for a list of RGB tuples and set the ColumnDataSource fill/line_color columns as lists of CSS-style RGB strings, but it seems (to me) inadvisible to change the ColumnDataSource values from how they were set.\r\n\r\nAlternatively, it'd be possible to check/update the fill/line_color props on the BokehJS side, but it seems unwise for the same reasons."}}