# Static Vertical dashed lines in Dash

**URL:** <https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372>\
**Category:** Dash Python\
**Created:** [April 3, 2018, 1:03pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372 "2018-04-03T13:03:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [April 3, 2018, 1:03pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/1 "2018-04-03T13:03:58Z")

</div>

Hi All,

I am working on a dash based app, where I have 2 subplots one below the other, in this I want to add a dashed vertical lines based on some conditions in the dataframe. Something like the uploaded snip please.

Bit idea on this would be helpful.

Thanks,  
M

 ![screenSnippet%20(1)](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/5/549bf74e91fe5a7d96c02142fd051e5630df9520.jpeg)

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [April 3, 2018, 1:57pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/2 "2018-04-03T13:57:11Z")

</div>

See [https://plot.ly/python/shapes/#vertical-and-horizontal-lines-positioned-relative-to-the-axes](https://plot.ly/python/shapes/#vertical-and-horizontal-lines-positioned-relative-to-the-axes)

---

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [April 3, 2018, 2:42pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/3 "2018-04-03T14:42:51Z")

</div>

Hi Thanks for your reply,

I have plotted subplots using the below code - unable to understand how to access shapes for each plot to insert lines on both the subplots.

```auto
fig = plotly.tools.make_subplots(rows=2,cols=1,shared_xaxes=False)
    fig['layout']['margin']={'l': 80, 'r': 0, 't': 50, 'b': 80}
    fig['layout']['annotations']=a
    fig['layout']['title']= ccypair[0:3]+'/'+ccypair[3:6]+": Flow Recap"
    fig.append_trace(mid,1,1)
    fig.append_trace(dt,2,1)
    fig.append_trace(dx,1,1)
    fig['layout']['yaxis1'].update(title=ccypair[0:3]+'/'+ccypair[3:6] + " rate"),
    fig['layout']['yaxis2'].update(title="Cumulative " + ccypair[0:3]+'/'+ccypair[3:6] + " flow, USD Equivalent")
    fig['layout']['shapes'].update(type='line',x=annotation.index,y=annotation.maxRate)

```

how can I use this in my code with subplots.

```auto
 'shapes': [
        # Line Vertical
        {
            'type': 'line',
            'x0': 1,
            'y0': 0,
            'x1': 1,
            'y1': 2,
            'line': {
                'color': 'rgb(55, 128, 191)',
                'width': 3,
            },
        },

```

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [April 3, 2018, 4:02pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/4 "2018-04-03T16:02:47Z")

</div>

`fig['layout']['shapes'] = [{'type': 'line', ...}]`

---

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [April 4, 2018, 7:45am UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/5 "2018-04-04T07:45:40Z")

</div>

Great thanks for your help, worked perfect so far. One more question on this though, I added the shapes, but it adds only to the top subplot, if you can help on for 2nd subplot will be great.

Many many thanks again.

Thanks,  
M

---

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [April 4, 2018, 2:39pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/6 "2018-04-04T14:39:52Z")

</div>

Please help on this? I am unable to set shapes to 2nd subplot.

---

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [April 4, 2018, 3:37pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/7 "2018-04-04T15:37:48Z")

</div>

Figured this out using xref & yref to x1/x2 & y1/y2

Thanks v much for help

---

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [April 5, 2018, 12:21pm UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/8 "2018-04-05T12:21:04Z")

</div>

Hi, I have a long legend to plot on the same subplot, which i want to place into multiple lines using line break using “\n”, but when i insert it in the string it straight away places \n in between rather than breaking into lines. Can you help please? I am not able to find any way to fix this?

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [April 6, 2018, 3:47am UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/9 "2018-04-06T03:47:14Z")

</div>

> [@mixy](#):
>
> Hi, I have a long legend to plot on the same subplot, which i want to place into multiple lines using line break using “\n”,

Could you create a new forum issue about this?

---

<div class="post-metadata">

**Author:** ![mixy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@mixy](https://community.plotly.com/u/mixy)\
**Post date:** [May 17, 2018, 8:11am UTC](https://community.plotly.com/t/static-vertical-dashed-lines-in-dash/9372/10 "2018-05-17T08:11:23Z")

</div>

“br” inside “\< \>” worked fine for the legends. Thanks for the help.
