bokeh / bokeh

Interactive Data Visualization in the browser, from Python
https://bokeh.org
BSD 3-Clause "New" or "Revised" License
19.33k stars 4.18k forks source link

Donut Chart Wrong Order #5662

Closed CreatCodeBuild closed 7 years ago

CreatCodeBuild commented 7 years ago

I have a Pandas Series.

PC                  999
PlayStation 3       815
Xbox 360            789
iPhone              505
Wii                 301
PlayStation 4       277
Nintendo 3DS        225
Xbox One            208
Nintendo DSi        200
PlayStation Vita    155
other               540
dtype: int64

I pass this Series to Donut

from bokeh.charts import Donut
from bokeh.io import output_file, show
from bokeh.layouts import gridplot

# series is a variable that I created
chart = Donut(series)

output_file("chart.html")
grid = gridplot([
    [chart]
])
show(grid)

I got this chart donut chart The order is wrong.

Should the order of values be the same of it in the Series

bryevdv commented 7 years ago

To the extent that donut charts are efficacious at all, I can imagine wanting to sort by other crirteria: e.g. by size order, or in a way that ensures long labels in small slices get rendered horizontally, so as not to overlap visually. Which is not to say Donut currently does these things; it doesn't. This is only to say that it's not clear to me that the only correct thing to do is to preserve the dataframe order, which is was you seem to imply.

In any case, bokeh.charts does not currently have an active maintainer. My best suggestion to you in the short term is to use the well-established bokeh.plotting API (e.g. the wedge glyph method) to create this sort of chart. It's slightly more verbose but also offers better control over the appearance.

Maggie-M commented 7 years ago

moving to bkcharts repo

github-actions[bot] commented 3 days ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.