Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Support range bounds for categorical axis #13830

Open
droumis opened this issue Apr 16, 2024 · 2 comments
Open

[FEATURE] Support range bounds for categorical axis #13830

droumis opened this issue Apr 16, 2024 · 2 comments

Comments

@droumis
Copy link
Member

droumis commented Apr 16, 2024

Problem description

We can set the navigable bounds of a continuous axis, e.g. p.x_range.bounds = (10, 50) but not a categorical axis, e.g. p.y_range.bounds = ("b", "f"). If the categorical axis ticks are unique, maybe they can be supported in this way?

image

Feature description

from bokeh.io import output_notebook
from bokeh.plotting import figure, show
output_notebook()

factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
x = [50, 40, 65, 10, 25, 37, 80, 60]

p = figure(y_range=factors)

p.scatter(x, factors, size=15, fill_color="orange", line_color="green", line_width=3)

p.x_range.bounds = (10, 50)
p.y_range.bounds = ("b", "f")

show(p)

Potential alternatives

Maybe we could define a mapping between categorical and continuous ticks and then use that instead to set the bounds

factors = [("a", 1), ("b", 2), ...]

Additional information

No response

@bryevdv
Copy link
Member

bryevdv commented Apr 16, 2024

Is this just about stopping excessive zoom out? The issue with providing "bounds" is that categorical factors do not have any intrinsic order so "start" and "end" do not make sense. Maybe there is another way to suppress excess zoom though, if that is the concern.

@droumis
Copy link
Member Author

droumis commented Apr 16, 2024

Is this just about stopping excessive zoom out?

Yes, the particular use-case is about limiting the navigable extents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants