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

colorbar() and hide_colorbar() has unexpected side-effect on line traces #1196

Closed
msummersgill opened this issue Feb 12, 2018 · 1 comment
Closed
Labels

Comments

@msummersgill
Copy link
Contributor

msummersgill commented Feb 12, 2018

This gives results as expected

with_colorbar <- plot_ly() %>% 
  add_markers(data = mtcars, x= ~ hp, y= ~mpg, color = ~wt) %>% 
  add_lines(x = seq.int(from= 100, to= 300, length.out = 20),
            y = seq.int(from= 10,  to= 30 , length.out = 20),
            line = list(color = "black"))

with_colorbar

image

hide_colorbar() and colorbar(limits=c(1,10)) add markers to the line

The two expressions below have the same behavior.

no_colorbar <- with_colorbar %>% hide_colorbar()
modified_colorbar <- with_colorbar %>%  colorbar(limits=c(1,10))

The following warning is printed to the console in both cases:

A marker object has been specified, but markers is not in the mode
Adding markers to the mode...

And markers are added to the line trace for both cases.

hide_colorbar() output

image

colorbar(limits=c(1,10)) output

image

@msummersgill msummersgill changed the title hide_colorbar() has unexpected side-effect on line traces colorbar() and hide_colorbar() has unexpected side-effect on line traces Feb 13, 2018
@msummersgill
Copy link
Contributor Author

One thing of note: the expression below works fine, the only argument to colorbar() that seems to trigger this behavior is limits.

with_colorbar %>% colorbar(title="Weight")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants