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

hv.Cycle() does not cycle through the entire list of colors #2333

Closed
ahuang11 opened this Issue Feb 11, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@ahuang11
Collaborator

ahuang11 commented Feb 11, 2018

After the 5th color, it starts from the first.

color_cycle = hv.Cycle([
                   'red',
                   'yellow',
                   'orange',
                   'green',
                   'blue',
                   'gray',
                   'black',
                   'brown',
                   'purple',
                   'pink'
                   ])

%%opts Curve (line_color=color_cycle)
ds.to.curve('target', 'valid_z', ['lead']).overlay()

image

@philippjfr

This comment has been minimized.

Member

philippjfr commented Feb 11, 2018

I believe this is because all cycles get tied together and since there is already a Cycle on color that one defines the length. I'd be strongly in favor of changing that behavior.

@ahuang11

This comment has been minimized.

Collaborator

ahuang11 commented Feb 11, 2018

A hack would be to just to double/triple the length color by repeating it. That way, the length would also be doubled/tripled without the default color list changed?

i.e if color was defined like this:

color = ['red', 'yellow',  'orange', 'green', 'blue'] * 2

Also is there a workaround for cycling through more than 5 colors?

@philippjfr

This comment has been minimized.

Member

philippjfr commented Feb 11, 2018

In this case I'd just override the default color cycle like this:

%%opts Curve (color=color_cycle)
ds.to.curve('target', 'valid_z', ['lead']).overlay()

color is an alias for line_color in this case, with the latter taking precedence.

@ahuang11

This comment has been minimized.

Collaborator

ahuang11 commented Feb 11, 2018

Oh, awesome; that worked. Is there a workaround for box-whisker plots?

Unexpected style option 'color' for BoxWhisker in loaded backend 'bokeh'.

@jlstevens

This comment has been minimized.

Member

jlstevens commented Feb 11, 2018

I agree..the shortest cycle shouldn't determine the length of the overall cycle. It should be the opposite and loop to match the longest cycle definition...

@ahuang11

This comment has been minimized.

Collaborator

ahuang11 commented Feb 18, 2018

To answer my own question, the style options cmap works for box-whisker plots.

@jlstevens jlstevens added this to the v2.0 milestone Feb 19, 2018

@philippjfr philippjfr modified the milestones: v2.0, v1.10 Mar 4, 2018

@philippjfr philippjfr added the bug label Mar 19, 2018

@philippjfr philippjfr referenced this issue Mar 23, 2018

Merged

Fixed expansion of Cycles of unequal lengths #2479

2 of 2 tasks complete

@philippjfr philippjfr closed this Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment