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

SideHistogram supports coloring weighted average #1087

Merged
merged 4 commits into from
Jan 29, 2017
Merged

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Jan 28, 2017

The adjoined histograms support coloring by a dimension on the main plot, but they also used to support coloring weighted histograms, which take the average in bins along the x- and y-axis. Coloring by the mean weighted value produces plots like this (matplotlib already handles this):

x,y = np.mgrid[-50:51, -50:51] * 0.1

img = hv.Image(np.sin(x**2+y**2), bounds=(-1,-1,1,1))

hmap = hv.HoloMap({phase: img.clone(np.sin(0.1*x**2+0.1*y**2+phase))
                   for phase in np.linspace(0, np.pi*2, 6)}, kdims=['Phase'])
hmap.hist(num_bins=100, dimension=['x', 'y'], weight_dimension='z', mean_weighted=True)

weighted_avg_hist

@philippjfr
Copy link
Member Author

Ready to merge, missing test data doesn't matter as no tests have changed.

@jlstevens
Copy link
Contributor

jlstevens commented Jan 29, 2017

Looks good!

I was expecting to see a much longer and more complicated diff given the description. Given that this is simply exposing functionality from the backend, I am happy to merge this PR.

That said, does this work in Bokeh if matplotlib isn't available? I'm still a little confused: the diff mostly seems to address color mapping issues and I don't yet see where the weight_dimension='z', mean_weighted=True arguments get supported (in a backend agnostic way).

@philippjfr
Copy link
Member Author

That said, does this work in Bokeh if matplotlib isn't available? I'm still a little confused: the diff mostly seems to address color mapping issues and I don't yet see where the weight_dimension='z', mean_weighted=True arguments get supported (in a backend agnostic way).

The histogram operation supports these already. It's just that bokeh didn't grab the correct color mapper in this case.

@jlstevens
Copy link
Contributor

The histogram operation supports these already. It's just that bokeh didn't grab the correct color mapper in this case.

Thanks for clarifying. Merging.

@jlstevens jlstevens merged commit 90c3d39 into master Jan 29, 2017
@jbednar jbednar deleted the histogram_cdims branch January 30, 2017 14:43
Copy link

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants