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

Allow defining color intervals #2797

Merged
merged 5 commits into from Jun 13, 2018
Merged

Allow defining color intervals #2797

merged 5 commits into from Jun 13, 2018

Conversation

@philippjfr
Copy link
Member

@philippjfr philippjfr commented Jun 12, 2018

This PR adds support for defining color intervals via the color_levels option. The color_levels option now allows defining a list of levels to map each supplied color to.

The example used in the docs is as follows:

levels = [0, 38, 73, 95, 110, 130, 156, 999]  
colors = ['#5ebaff', '#00faf4', '#ffffcc', '#ffe775', '#ffc140', '#ff8f20', '#ff6060']

path = [
    (-75.1, 23.1, 0),   (-76.2, 23.8, 0),   (-76.9, 25.4, 0),   (-78.4, 26.1, 39),  (-79.6, 26.2, 39),
    (-80.3, 25.9, 39),  (-82.0, 25.1, 74),  (-83.3, 24.6, 74),  (-84.7, 24.4, 96),  (-85.9, 24.8, 111),
    (-87.7, 25.7, 111), (-89.2, 27.2, 131), (-89.6, 29.3, 156), (-89.6, 30.2, 156), (-89.1, 32.6, 131),
    (-88.0, 35.6, 111), (-85.3, 38.6, 96)
]

hv.Path([path], vdims='Wind Speed').options(
    color_index='Wind Speed', color_levels=levels, cmap=colors, line_width=8, colorbar=True, width=450
)

bokeh_plot

@philippjfr philippjfr force-pushed the color_intervals branch from 8fa666a to 150b8f3 Jun 12, 2018
@philippjfr
Copy link
Member Author

@philippjfr philippjfr commented Jun 13, 2018

Ready to merge when tests pass.

@jlstevens
Copy link
Contributor

@jlstevens jlstevens commented Jun 13, 2018

Looks good to me. Merging.

@jlstevens jlstevens merged commit ed3df85 into master Jun 13, 2018
4 checks passed
4 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.7%) to 83.695%
Details
@philippjfr
s3-reference-data-cache Test data is cached.
Details
@philippjfr philippjfr deleted the color_intervals branch Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants