Skip to content

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

@msummersgill

Description

@msummersgill

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions