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

Conversation

Projects
None yet
2 participants
@philippjfr
Member

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 philippjfr added the bokeh label Jan 28, 2017

@philippjfr

This comment has been minimized.

Member

philippjfr commented Jan 29, 2017

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

@jlstevens

This comment has been minimized.

Member

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

This comment has been minimized.

Member

philippjfr commented Jan 29, 2017

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

This comment has been minimized.

Member

jlstevens commented Jan 29, 2017

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

3 of 4 checks passed

s3-reference-data-cache Test data not cached, see details to rebuild.
Details
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.2%) to 77.6%
Details

@jbednar jbednar deleted the histogram_cdims branch Jan 30, 2017

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