Skip to content

Shapes are always on top (foreground) #370

Closed
@zerweck

Description

@zerweck

When one adds a trace to an existing plot, it will be drawn on top of earlier defined traces. However, when one adds a shape, it will always be on top of everything else. Example:

library(plotly)
p <- plot_ly(economics, x = date, y = uempmed, name = "unemployment",line=list(color="yellow"))

p <- layout(p, title = 'Highlighting with Rectangles', 
            shapes = list(
              list(type = "rect", 
                   fillcolor = "blue", line = list(color = "blue"), opacity = 0.5, 
                   x0 = "1980-01-01", x1 = "1985-01-01", xref = "x", 
                   y0 = 4, y1 = 12.5, yref = "y"))) 

p # Shapes are in front of the line
p <- add_trace(economics, x = date, y = uempmed, name = "unemployment",line=list(color="white"))
p # Shapes are still in front of the line

Is this intended or unwanted behaviour?

Using plotly_2.0.18.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions