Title: Annotations for grouped bar charts · Issue #356 · plotly/plotly.py · GitHub
Open Graph Title: Annotations for grouped bar charts · Issue #356 · plotly/plotly.py
X Title: Annotations for grouped bar charts · Issue #356 · plotly/plotly.py
Description: I was trying to create annotations for grouped bar charts - where each bar has a specific data label. An example is as follows: https://plot.ly/~ashish.baghudana/49.embed However, as you see the data labels are not centered individually,...
Open Graph Description: I was trying to create annotations for grouped bar charts - where each bar has a specific data label. An example is as follows: https://plot.ly/~ashish.baghudana/49.embed However, as you see the da...
X Description: I was trying to create annotations for grouped bar charts - where each bar has a specific data label. An example is as follows: https://plot.ly/~ashish.baghudana/49.embed However, as you see the da...
Opengraph URL: https://github.com/plotly/plotly.py/issues/356
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Annotations for grouped bar charts","articleBody":"I was trying to create annotations for grouped bar charts - where each bar has a specific data label.\n\nAn example is as follows: https://plot.ly/~ashish.baghudana/49.embed\n\n\nHowever, as you see the data labels are not centered individually, but overall. I was wondering if there is a workaround to this, rather than annotating manually.\n\nAppreciate the help!\n\nThe code itself is a simple modification of the examples in tutorial.\n\n``` python\nimport plotly.plotly as py\nimport plotly.graph_objs as go\n\nx = ['Product A', 'Product B', 'Product C']\ny1 = [20, 14, 23]\ny2 = [12, 18, 29]\n\nannotations1 = [dict(\n x=xi,\n y=yi,\n text=str(yi),\n xanchor='auto',\n yanchor='bottom',\n showarrow=False,\n ) for xi, yi in zip(x, y1)]\nannotations2 = [dict(\n x=xi,\n y=yi,\n text=str(yi),\n xanchor='auto',\n yanchor='bottom',\n showarrow=False,\n ) for xi, yi in zip(x, y2)]\nannotations = annotations1 + annotations2\n\ntrace1 = go.Bar(\n x=x,\n y=y1,\n name='SF Zoo'\n)\ntrace2 = go.Bar(\n x=x,\n y=y2,\n name='LA Zoo'\n)\ndata = [trace1, trace2]\nlayout = go.Layout(\n barmode='group',\n annotations=annotations\n)\nfig = go.Figure(data=data, layout=layout)\nplot_url = py.plot(fig, filename='stacked-bar')\n```\n","author":{"url":"https://github.com/ashishbaghudana","@type":"Person","name":"ashishbaghudana"},"datePublished":"2015-11-23T14:08:47Z","url":"https://github.com/plotly/plotly.py/issues/356"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4df83a01-5d65-d1d0-0b50-12b95b0fe2ec |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 81C2:38E318:1BC1362:230A463:6B018E6E |
| html-safe-nonce | 9054ca80262904648e699a21769afdc1c5669a18067895abc84334bb25464fbd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUMyOjM4RTMxODoxQkMxMzYyOjIzMEE0NjM6NkIwMThFNkUiLCJ2aXNpdG9yX2lkIjoiMjEwMTUxMTA5NzI0Nzk2MDY4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2aea8dbab250837f03e30c7a82264d5c0487af65bf0c194ddd7bc726f73d5670 |
| hovercard-subject-tag | issue:118386533 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.py/356/issue_layout |
| twitter:image | https://opengraph.githubassets.com/90d99526625832f612c85f2e550d91676ab198e1e13da9a36b8df045110ed51d/plotly/plotly.py/issues/356 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/90d99526625832f612c85f2e550d91676ab198e1e13da9a36b8df045110ed51d/plotly/plotly.py/issues/356 |
| og:image:alt | I was trying to create annotations for grouped bar charts - where each bar has a specific data label. An example is as follows: https://plot.ly/~ashish.baghudana/49.embed However, as you see the da... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ashishbaghudana |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 14579099 |
| octolytics-dimension-repository_nwo | plotly/plotly.py |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14579099 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.py |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width