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

Override names in legend for inputs that are part of a dict #279

Merged
merged 6 commits into from
Nov 16, 2023

Conversation

nvaytet
Copy link
Member

@nvaytet nvaytet commented Nov 15, 2023

Before, when we were passing data array in a dict, but they already had names, the keys in the dict would not be used in the legend.
This meant that for example

import plopp as pp
import scipp as sc

da1 = pp.data.data1d()
da2 = da1 * 2

da1.name = "DA1"
da2.name = "DA2"

pp.plot({'a': da1, 'b': da2})

would show DA1 and DA2 in the legend, which is confusing since you would think if you pass a dict, those keys would be used. The .name on a data array may have been sat in a very different place, if fx it was inserted in a Dataset many lines above in the notebook.

Now, the keys of the dict (or DataGroup) override the underlying names on the input.
Note that the inputs' names are not modified in-place.

@nvaytet nvaytet merged commit 46ec33e into main Nov 16, 2023
3 checks passed
@nvaytet nvaytet deleted the override_names branch November 16, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants