# Two Y-axis in PlotlyJS

**URL:** <https://discourse.julialang.org/t/two-y-axis-in-plotlyjs/62701>\
**Category:** New to Julia\
**Tags:** plotting\
**Created:** [June 10, 2021, 8:47pm UTC](https://discourse.julialang.org/t/two-y-axis-in-plotlyjs/62701 "2021-06-10T20:47:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [June 10, 2021, 8:47pm UTC](https://discourse.julialang.org/t/two-y-axis-in-plotlyjs/62701/1 "2021-06-10T20:47:31Z")

</div>

Hi,

I am trying to come up with a two yy-axis in a plot using PlotlyJS. I have tried many variations on the Plotly example (displayed below), but all the time, something comes out wrong. Help will be very much appreciated. Thanks.

```julia
import plotly.graph_objects as go
from plotly.subplots import make_subplots

# Create figure with secondary y-axis
fig = make_subplots(specs=[[{"secondary_y": True}]])

# Add traces
fig.add_trace(
    go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name="yaxis data"),
    secondary_y=False,
)

fig.add_trace(
    go.Scatter(x=[2, 3, 4], y=[4, 5, 6], name="yaxis2 data"),
    secondary_y=True,
)

# Add figure title
fig.update_layout(
    title_text="Double Y Axis Example"
)

# Set x-axis title
fig.update_xaxes(title_text="xaxis title")

# Set y-axes titles
fig.update_yaxes(title_text="<b>primary</b> yaxis title", secondary_y=False)
fig.update_yaxes(title_text="<b>secondary</b> yaxis title", secondary_y=True)

fig.show()

```

The plot will look like this:

 ![abc](https://global.discourse-cdn.com/julialang/original/3X/8/5/853d7aa52085f1cc23912290f49e3d358243e47d.png)

---

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [July 6, 2021, 9:11am UTC](https://discourse.julialang.org/t/two-y-axis-in-plotlyjs/62701/2 "2021-07-06T09:11:28Z")

</div>

Solved by @disberd [here](https://discourse.julialang.org/t/pluto-plots-with-plotlybase-plotlyjs-with-working-static-html-export/61730)
