-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Add plot option to transpose layouts #1100
Conversation
8692751
to
6eeebc4
Compare
Thanks so much! |
holoviews/plotting/plot.py
Outdated
@@ -1030,6 +1030,9 @@ class GenericLayoutPlot(GenericCompositePlot): | |||
displays the elements in a cartesian grid in scanline order. | |||
""" | |||
|
|||
transpose = param.Boolean(default=False, doc=""" | |||
Whether to transpose the layout when plotting""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to say the normal behavior is scanline order (left to right, top to bottom) and that transposing makes it work top to bottom and left to right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'll make sure to add some tests too.
Other than a suggestion for improving the docstring, this looks good and I'm happy to merge. |
I can't tell from the code -- will this make the subfigure labels transpose as well? Presumably we'd want them to, because if the ordering in the layout has any meaning, the layout's order will now be top to bottom instead of left to right. |
True, currently not the case, it simply labels as normal now. |
It's a start, then, but changing the label order seems dangerous to put off until later, because if we ever do implement that, a previously labeled transposed figure will no longer match its caption. |
Now handles the subfigure labels too. Ready to merge when tests pass. |
All tests are green. Merging. |
Sorry I didn't get a chance to test this earlier, but I think this is a problem: the Shouldn't The code in that example is from https://github.com/bokeh/colorcet/blob/master/docs/index.ipynb , where the definition of |
It could do, but it's not really a transpose in that case, and the implementation would be a lot uglier. |
Drat. If you look at that example notebook as updated with the new colormaps function above, you'll see that the transpose option doesn't really work, then -- the idea was to have a fixed number of columns, but to start to fill them top to bottom, not left to right. As it is now, sometimes there are two columns, sometimes 50, which doesn't work from a layout perspective because the width of a web page is fixed: I.e., a fixed number of columns is about the only thing that makes sense on a webpage that scrolls vertically; cramming in all the plots left to right doesn't seem like it would normally be useful in practice. |
It can be faked by having setting the cols() to a fraction of the length of the layout, but that's very fragile. |
True, it depends on the layout not changing length. I'll investigate what the alternative looks like. |
I'm wondering if the |
This definition of cols seems to work fine:
So is it possible to stick that when the columns value is used, so that it uses that version instead of the cols number directly, if it's transposed? |
Right. That is what I was suggesting...and now you've shown a concrete implementation, I can't see why the plotting class can't use similar logic. |
It probably can easily enough, I'll look into it. |
One annoyance is that we have the current |
I don't think |
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. |
As requested in #909 this adds a plot option to transpose layouts. It was trivial to implement and provides useful functionality.