Skip to content

[query/ggplot] fixes math for continuous color scales - #13609

Merged
danking merged 1 commit into
hail-is:mainfrom
iris-garden:query/ggplot/continuous-colors
Sep 13, 2023
Merged

[query/ggplot] fixes math for continuous color scales#13609
danking merged 1 commit into
hail-is:mainfrom
iris-garden:query/ggplot/continuous-colors

Conversation

@iris-garden

Copy link
Copy Markdown
Contributor

CHANGELOG: Fixed a bug in hail.ggplot.scale_color_continuous that sometimes caused errors by generating invalid colors.

For example, this code:

import hail as hl
from hail.ggplot import ggplot, aes, geom_point
t = hl.utils.range_table(10)
t = t.annotate(x=hl.rand_unif(), y=hl.rand_unif(), z=hl.rand_unif(1, 10))
fig = ggplot(t, aes(x=t.x, y=t.y, color=t.z)) + geom_point()
fig.show()

Produces an error like this:

ValueError:
    Invalid element(s) received for the 'color' property of scatter.marker
        Invalid elements include: ['rgb(-84, -187, 123)', 'rgb(-116, -227, 131)', 'rgb(-29, -120, 109)', 'rgb(-33, -125, 110)', 'rgb(15, -65, 97)', 'rgb(10, -71, 99)', 'rgb(-112, -223, 130)', 'rgb(-63, -162, 117)', 'rgb(-81, -185, 122)', 'rgb(31, -45, 93)']

But after this change is applied, it produces a plot like this:

newplot(2)

@danking
danking merged commit bdf055e into hail-is:main Sep 13, 2023
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.

3 participants