# Two y axis in one chart

**URL:** <https://community.plotly.com/t/two-y-axis-in-one-chart/13868>\
**Category:** Dash Python\
**Created:** [September 23, 2018, 5:36am UTC](https://community.plotly.com/t/two-y-axis-in-one-chart/13868 "2018-09-23T05:36:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulCaballero30](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@PaulCaballero30](https://community.plotly.com/u/PaulCaballero30)\
**Post date:** [September 23, 2018, 5:36am UTC](https://community.plotly.com/t/two-y-axis-in-one-chart/13868/1 "2018-09-23T05:36:54Z")

</div>

Hi Team,

I’m having a hard creating two y axis in my chart here is my sample code below:

traces = []  
traces.append(go.Bar(  
x=df\_invoice\_creds[‘Date’],  
y=df\_invoice\_creds[‘INVOICES’],  
name=‘Invoices’  
))

```
traces_creds = []
traces_creds.append(go.Scatter(
        x=df_invoice_creds['Date'],
        y=df_invoice_creds['CREDITS'],
        name='Credits',
        yaxis='y2'
))
return html.Div([
    dcc.Graph(
            id='invoices_creds',
            figure={
                'data': traces,
                'layout': {
                    'margin': {'l': 80,'r': 0,'b': 50,'t': 30 },
                    'yaxis': dict(title='Invoices(vol)'),
                    'yaxis2': dict(
                                title='Credits',
                                titlefont=dict(
                                color='rgb(148, 103, 189)'
                            ),
                                tickfont=dict(
                                color='rgb(148, 103, 189)'
                            ),
                                overlaying='y',
                                side='right',
                                tickvals=[2,6,8,9]
                    ),
                    'height': 300,
                'legend': {'x': 'dash', 'y': 'test'},
                'title':'Invoices for ' + str(iot) + ' ' + str(selected_brand)
                }
            },
            #animate=True,
        )
]),

```

Appreciate your help and thank you in advance.

Warm Regards,  
Paul Caballero
