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

Reimplemented Layout aspects handling #457

Merged
merged 4 commits into from Feb 6, 2016

Conversation

Projects
None yet
2 participants
@philippjfr
Copy link
Contributor

philippjfr commented Feb 5, 2016

The previous PR improved aspect handling in Layouts but did not really fix it. This new implementation actually does what it's supposed to. I'd appreciate it if you could try some complex layout arrangements and then fiddling with the aspects of the individual components.

Here's some that I've tried:

%%opts Layout [aspect_weight=1.0 absolute_scaling=True] Image.A [aspect=1.5] Image.C [aspect=0.5]
np.random.seed(42)
(hv.Image(np.random.rand(25, 25), group='A') +
 hv.Image(np.random.rand(25, 25), group='B') +
 hv.Image(np.random.rand(25, 25), group='C'))

image

Here absolute scaling controls whether the plots are scaled in absolute or relative terms, i.e. in the example relative scaling means that plot A (aspect=1.5) is the width of a usual plot and everything else is scaled down relative to that and absolute scaling means plot A is actually 1.5 times wider than it would usually be.

A more complex example is this:

%%opts Layout [aspect_weight=1 sublabel_format='']
%%opts Image [aspect=1] Area.A [invert_axes=True aspect=0.4] Area.B [aspect=3]
img_a = hv.Image(np.random.rand(25, 25), group='A')
img_b = hv.Image(np.random.rand(25, 25), group='B')
img_a.hist() + hv.Area(img_b.reduce(x=np.mean), group='A') + img_b + hv.Area(img_a.reduce(x=np.mean), group='A') +\
hv.Area(img_b.reduce(y=np.mean), group='B').hist() + hv.Empty() + hv.Area(img_b.reduce(y=np.mean), group='B') + hv.Empty()

image

Philipp Rudiger added some commits Feb 5, 2016

@philippjfr philippjfr added this to the v1.4.2 milestone Feb 6, 2016

@philippjfr

This comment has been minimized.

Copy link
Contributor Author

philippjfr commented Feb 6, 2016

Good to go I think. It's still not perfect but it's the most robust implementation I've gotten so far. Hopefully by 1.5 or 1.6 we'll have redesigned specifying and plotting layouts and won't have to rely on trying to infer a good arrangement based on the aspects of the individual plots.

@jlstevens

This comment has been minimized.

Copy link
Contributor

jlstevens commented Feb 6, 2016

I do think this is a big improvement. No doubt we'll encounter new bugs but it does look like the behaviour is going to be a lot better on average. Merging.

jlstevens added a commit that referenced this pull request Feb 6, 2016

Merge pull request #457 from ioam/layout_fix
Reimplemented Layout aspects handling

@jlstevens jlstevens merged commit bf524a3 into master Feb 6, 2016

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.04%) to 69.685%
Details
s3-reference-data-cache Tests passing no test data changes required.
Details

@jlstevens jlstevens deleted the layout_fix branch Feb 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.