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

opts magic inheritance cmap #646

Closed
marqh opened this issue Apr 27, 2016 · 5 comments
Closed

opts magic inheritance cmap #646

marqh opened this issue Apr 27, 2016 · 5 comments
Assignees
Labels
tag: component: options type: bug Something isn't correct or isn't working

Comments

@marqh
Copy link
Contributor

marqh commented Apr 27, 2016

import iris
import holoviews as hv
import geoviews as gv
import cube_browser
import cartopy
cube = iris.load_cube(iris.sample_data_path('rotated_pole.nc'))

with a specification of Dataset, the color map is preserved:

%%opts FilledContours.Air_pressure_at_sea_level [levels=7]

airp = hv.Dataset(cube)
airp.to.filledcontours(['grid_longitude', 'grid_latitude'], dynamic=True)  * gv.Feature(cartopy.feature.COASTLINE)

but, if the FilledContours does not specifiy the Air_pressure...., the colormap is overridden


%%opts FilledContours.Air_pressure_at_sea_level [levels=7]

airp = hv.Dataset(cube)
airp.to.filledcontours(['grid_longitude', 'grid_latitude'], dynamic=True)  * gv.Feature(cartopy.feature.COASTLINE)

this last call should not alter the colormap

@philippjfr
Copy link
Member

philippjfr commented Apr 27, 2016

I can't tell the difference between your two examples. Presumably you meant:

%%opts FilledContours [levels=7]

in the second example. If so that's a bug propagating the custom options correctly and probably originates in the StoreOptions.create_custom_trees method. I'll assign it to @jlstevens.

Edit: Just went through the logic in that method and as far as I can tell it definitely originates there. It creates a new custom tree using the specification passed in via the magic rather than traversing the object to get the full type.group.label spec of all the Elements that the custom options apply to. So it ends up making a copy of the options.FilledContours node rather than copying the options.FilledContours.Air_pressure_at_sea_level which holds the colormap setting.

@bjlittle
Copy link

@jlstevens says: yes, it is fine to assign it to him and you are right that the example is wrong (your version is right)

@philippjfr
Copy link
Member

It's a pretty tricky problem and I know roughly how to fix it but actually implementing the correct solution will still be pretty difficult. Hopefully @jlstevens will have the time to tackle it this week, otherwise I'll try to spend an hour or two on it over the weekend.

@philippjfr philippjfr added this to the v1.6.0 milestone Apr 29, 2016
@philippjfr philippjfr added type: bug Something isn't correct or isn't working tag: component: options labels Apr 29, 2016
@philippjfr philippjfr modified the milestones: v1.5.1, v1.6.0 Jul 1, 2016
@jlstevens jlstevens removed this from the v1.5.1 milestone Jul 17, 2016
@philippjfr
Copy link
Member

This has finally been fixed in #796. Closing.

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tag: component: options type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

4 participants