{"action":"created","issue":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/2349","labels_url":"https://api.github.com/repos/bokeh/bokeh/issues/2349/labels{/name}","comments_url":"https://api.github.com/repos/bokeh/bokeh/issues/2349/comments","events_url":"https://api.github.com/repos/bokeh/bokeh/issues/2349/events","html_url":"https://github.com/bokeh/bokeh/issues/2349","id":82116079,"number":2349,"title":"Change color of each Bar in a Bar graph","user":{"login":"moqca","id":2406146,"avatar_url":"https://avatars.githubusercontent.com/u/2406146?v=3","gravatar_id":"","url":"https://api.github.com/users/moqca","html_url":"https://github.com/moqca","followers_url":"https://api.github.com/users/moqca/followers","following_url":"https://api.github.com/users/moqca/following{/other_user}","gists_url":"https://api.github.com/users/moqca/gists{/gist_id}","starred_url":"https://api.github.com/users/moqca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moqca/subscriptions","organizations_url":"https://api.github.com/users/moqca/orgs","repos_url":"https://api.github.com/users/moqca/repos","events_url":"https://api.github.com/users/moqca/events{/privacy}","received_events_url":"https://api.github.com/users/moqca/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bokeh/bokeh/labels/type:%20discussion","name":"type: discussion","color":"2659A0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-28T20:42:52Z","updated_at":"2015-06-01T17:59:55Z","closed_at":null,"body":"Is there a way to have each Bar on a Bar graph have a different color?\r\nI want to color the bars based on their value. I was thinking that using a palette would work for this, but this changes the color for all bars."},"comment":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/comments/107655201","html_url":"https://github.com/bokeh/bokeh/issues/2349#issuecomment-107655201","issue_url":"https://api.github.com/repos/bokeh/bokeh/issues/2349","id":107655201,"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-06-01T17:59:54Z","updated_at":"2015-06-01T17:59:54Z","body":"Q: Is there a way to have each Bar on a Bar graph have a different color?\r\nA: Not really. The way the colormapper maps the color across the bars is that each \"category\" of bars are given the same color.\r\n\r\nsource: http://bokeh.pydata.org/en/latest/docs/user_guide/charts.html#bar-and-dot-charts\r\n\r\nSolutions:\r\n\r\nThe hacky solution is to make a grouped bar chart that has only 1 group and each value is it's own category. This would allow you to apply a palette across the set of bars.\r\n\r\n    from bokeh.charts import Bar, output_notebook, show, vplot\r\n    from bokeh.palettes import Blues5\r\n\r\n    output_notebook()\r\n\r\n    data = {\"a\":[4,], \"b\": [6,], \"c\":[7,], \"d\":[2,], \"e\":[6,]}  ## makes each value a unique category\r\n    ##data = [4, 6, 7, 2, 6] will make them all the same category\r\n\r\n    plot2 = Bar(data, title='Unstacked example', stacked=False,\r\n           xlabel='categories', ylabel='values', width=400, height=400, palette=Blues5,\r\n           tools = \"pan,wheel_zoom,box_zoom,reset,resize\")\r\n\r\n    show(plot2)\r\n\r\nThe better solution is to manually make a bar chart with Rects and relate each color it the Rect height.\r\n\r\nsource: http://bokeh.pydata.org/en/latest/docs/user_guide/plotting.html#rectangles-and-ovals"}}