Skip to content

Subplot with Multiple Shapes #533

@TonyDIRL

Description

@TonyDIRL

Hi,

I am attempting to place a shape on each of several subplots.
Here is an example:

subplot(
  plot_ly(economics, x = date, y = uempmed,xaxis  ="x"),
  plot_ly(economics, x = date, y = unemploy,xaxis ="x2"),
  margin = 0.05
) %>% layout(xaxis=list(title   = "Plot1"),xaxis2=list(title   = "Plot2"),
             shapes = list(list(type = "rect",x0 = "1980-01-01", x1 = "1985-01-01", xref = "x", y0 = 4,     y1 = 12.5, yref = "y"),
                      list(list(type = "rect",x0 = "1980-01-01", x1 = "1985-01-01", xref = "x2",y0 = 4000,  y1 = 6000, yref = "y2"))))

Unfortunately, both shapes are appearing on the left hand plot.

How do I place the second shape on the right hand plot?

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