Fixed categorical_order_by used with array_like #157
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Fixes bug with categorical_order_by and numpy arrays / pandas series
Which issue(s) this PR fixes
Fixes #74
Special notes for your reviewer:
While writing the tests I discovered some weirdness in the chart data:
PlotMixedTypeXY._construct_source
) is in order of the specified orderingNevertheless, in the chart, the data is displayed correctly, because not the order of the chart data defines the category order but the order of the factors of
bokeh.plotting.figure.x_range
(vertical) orbokeh.plotting.figure.y_range
(horizontal).And that is set by
PlotMixedTypeXY._set_categorical_axis_default_factors
.What happens is that:
PlotMixedTypeXY._construct_source
, the data gets sorted and then thex_range
is set accordinglyx_range.factors
is set but the actual data does not get sortedSo it seems like sorting the actual data (like in
_construct_source
) is unnecessary as bokeh does not consider the order of the data itself but instead maps the observations to the corresponding factors in thex_range
.I think this can be addressed in a separate issue.
Release note: