# Plotly Multi-Y Axis with same X axis time chart

Hi All!

Looking for some help on this:

Iβm trying to create a chart with 2 Y-axis.

The first is a candlestick chart, the 2nd is a simple line chart.
Both have the same X axis.

When I plot this, the x-axis of the candlestick chart is covering up my line chart. Is there a way to force x-axis labels to be under the line graph instead?

``````    traces = []
#yy/mm/dd H
traces.append(go.Candlestick(
name = 'Candlestick',
x=df['x'],
open=df.Open,
high=df.High,
low=df.Low,
close=df.Close))
## Y2
traces.append(go.Scatter(x=df['x'], y=k['data'], mode='lines',name=k['name'], showlegend=False, yaxis="y2"))
``````

Layout:

``````                    title=agg,
margin={'l': 10, 'r': 10, 't': 40, 'b': 10},
yaxis={
"domain":[.3, 1]
},
yaxis2={
"side": "right",
"domain": [0, 0.3]
},
xaxis={
"type": 'category',
"categoryorder": 'category ascending',
"showspikes": True,
"tickangle" : 45,
"range": [s-50,s]
},
uirevision = symbol,
showlegend=True,
legend_orientation="h",
legend=dict(x=.25, y=1.1),
)
``````

The last example on here https://plot.ly/python/subplots/ " Stacked Subplots with a Shared X-Axis" is what Iβm looking to replicate.

Moving this to API, Python as it would make more sense.

@vantaka2 When you define `fig=make_subplots()` set `vertical_spacing=a`, with 0<a<1, such that to avoid overlapping of the two charts:

``````from plotly.subplots import make_subplots
import plotly.graph_objects as go
import pandas as pd
from datetime import datetime

fig = make_subplots(
rows=2, cols=1,
subplot_titles=("Title 1", "Title 2"),
shared_xaxes=True,
vertical_spacing =0.3)# tune this value until the two charts don't overlap

I = [4*k for k in range(127)]

xx  =  df['Date'][I]