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

DataInspector: fix an attribute extraction bug for heatmaps & images #3260

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

Sagnac
Copy link
Contributor

@Sagnac Sagnac commented Sep 27, 2023

Description

Fixes #3101

If the colorrange attribute is left at default it returns MakieCore.Automatic; the method for get that was called at show_imagelike does not check for this type so the ensuing call to interpolated_getindex would fail.

The colorrange is now generically extracted and calculated_colors[].colorrange[] is preferred as it contains the actual range.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@Sagnac
Copy link
Contributor Author

Sagnac commented Sep 28, 2023

I've updated the PR

@Sagnac
Copy link
Contributor Author

Sagnac commented Oct 20, 2023

Does everything look good now or are there other things I should change or add?

@SimonDanisch
Copy link
Member

@ffreyer i think so right?
Maybe error instead of using (0, 1) since this can't be correct for DataInspector?

@ffreyer
Copy link
Collaborator

ffreyer commented Oct 20, 2023

What's the state with heatmap and image now, after calculated_colors got added? Do those always include calculated_colors and does that always include a colorrange? If so it should just query that. (Since DataInspector relies on pick the first time these functions can get called is after the first render, if that matters.)

@SimonDanisch
Copy link
Member

Yeah heatmap + image should always have calculated color, IF they map numbers to a color via colormap

@Sagnac
Copy link
Contributor Author

Sagnac commented Oct 21, 2023

Do you have a preference for the error message? I was going to go with colorrange not found, but I realize it's not very descriptive. Maybe something along the lines of
calculated_colors for the plot is missing or is not a proper color map. Please specify a colorrange.?

@SimonDanisch
Copy link
Member

Since this should only be called for Heatmap/Image which always should have a colorrange in calculated_colors, I think this should be more of "this should not happen" internal kind of error.

If the colorrange attribute is left at default it returns
MakieCore.Automatic; the method for `get` that was called at
show_imagelike does not check for this type so the ensuing call to
interpolated_getindex would fail.

The colorrange is now generically extracted and
calculated_colors[].colorrange[] is preferred as it contains the actual
range.

Fixes MakieOrg#3101
@Sagnac
Copy link
Contributor Author

Sagnac commented Oct 24, 2023

How do things look now?

@SimonDanisch
Copy link
Member

Thank you!! :)

@SimonDanisch SimonDanisch merged commit def433d into MakieOrg:master Oct 24, 2023
14 checks passed
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.

DataInspector not working with a heatmap
4 participants