-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Specification of options for multiple Paths #995
Comments
Thanks for filing this issue! This feature is one I have considered before and would be happy to support. The place I would implement this is here in the from holoviews.ipython.parser import OptsSpec
OptsSpec.parse('Image [width=100] (s=3) Curve [width=100] (s=3)')
{'Curve': {'plot': Options(width=100), 'style': Options(s=3)},
'Image': {'plot': Options(width=100), 'style': Options(s=3)}} What we need for this feature to work: from holoviews.ipython.parser import OptsSpec
OptsSpec.parse('Image Curve [width=100] (s=3)')
{'Curve': {'plot': Options(width=100), 'style': Options(s=3)},
'Image': {'plot': Options(width=100), 'style': Options(s=3)}} Currently the return value is this:
You shouldn't need to worry about the pyparsing stuff in that file and can probably just copy the dictionaries as appropriate at the end of the One worry is about the semantics as I think this is a bit of a special case:
(note that
Here I would expect only Anyway, hope that gets you started! I don't think it should be too hard to implement and would be a useful feature. The main reason I wouldn't want to accept this feature is if we find it breaks backwards compatibility somehow (I don't think it does). Edit: As the output is a dictionary (unordered) and there are some ordering effects (e.g as shown in the last example above), you'll probably need to figure out how to group things while iterating over the groups in this loop: for group in cls.opts_spec.parseString(line):
... I would consider building a datastructure (e.g a list of tuples) in the loop to figure out which plot options need to be unioned. E.g in the last example this thing would be something like |
As discussed on gitter, option grouping should work for all types of options, such that
is strictly equivalent to
and also generalizes to more than two pathspecs. Additionally, we noticed that option definitions are not properly merged right now: hv.ipython.parser.OptsSpec.parse("Image (c='b') Image (s=3)")
{'Image': {'style': Options(s=3)}} While we're at it, this should also be fixed to result in {'Image': {'style': Options(c='b', s=3)}} |
I've added the issue to the milestone so we don't forget to mention it in our release notes. But since this is now implemented I'll close. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Since there is currently no propagation of options for plots (see #638), I quite often find myself specifying the same plotting options for one specific element, say a
Curve
, and all elements which might wrap this element, such asOverlay
orLayout
. This results in quite some repetition when done using the%opts
-magic:Ideally, I would like to be able to specify multiple paths at once for which the following styles should be applied, like so:
This, I think, is legal right now, it just has different semantics: The options are only applied to
NdOverlay
, while for bothCurve
andOverlay
this is a no-op. Since I do not expect the specification of no-ops to be of any use, it should not be too bad to change it.I would be happy to get my feet wet with holoviews and implement this myself. If you can point me into the right direction, I will get started.
The text was updated successfully, but these errors were encountered: