Second yaxis - but where's the first one?

#1

Love the Dash charts and amazing flexibility. Having an issue with secondary y-axis on a simple scatter chart. Or to be more precise - my primary axis is not showing no matter what I try (I can get it to show ONLY the left y-axis as well).
Having a hard time finding clear documentation on the settings for the axis (finding mostly example pages). I’ll be happy to update documentation somewhere once I have figured this out!

here’s the data dict
{ ‘data’: [
go.Scatter( x= years[‘year’], y=years[‘Amount’], text=‘Total Seed Amount’),
go.Scatter( x= years[‘year’], y=years[‘Transactions’], text=‘Total Seed Rounds’,yaxis=‘y1’) ],
‘layout’: go.Layout(
title=‘Total US Seed Rounds \n2010-2018’,
xaxis={
‘title’: ‘Year’,
‘type’: ‘linear’
},
yaxis={
‘title’: ‘Amount (USD x millions)’,
},
yaxis1={
‘title’: ‘# of Transactions’,
‘overlaying’: ‘y1’,
‘side’: ‘right’

},

margin={'l': 0, 'b': 40, 't': 40, 'r': 0},
        hovermode='closest',
    showlegend=False
    ) }

And this is what it looks like:

Why is the left y-axis not showing. I have played with naming the axis (yaxis=‘y’), overlaying, side=left - nothing seems to make a difference.

Any thoughts??
Thanks!

#2

@jlvanhulst, yaxis is equivalent to yaxis1 in plolty so you’ll need to name the first axis yaxis and the second one yaxis2 and you’ll need to reference that axis as y2 in your trace.

#3

Thank you @michaelbabyn that did it!

For reference if someone runs into this here’s the working version. The problem I had with ‘getting it right’ was that some settings make the one of the lines disappear while both axis show.

{ 'data': [
    go.Scatter( x= years['year'], y=years['Amount'], text='Total Seed Amount', yaxis='y1'),
    go.Scatter( x= years['year'], y=years['Transactions'], text='Total Seed Rounds',yaxis='y2') ],
    'layout': go.Layout(
            title='Total US Seed Rounds \n2010-2018',
            xaxis={
                'title': 'Year',
                'type': 'linear'
            },
    yaxis={
        'title': 'Amount (USD x millions)',
    },
    yaxis2={
        'title': '# of Transactions',
        'overlaying': 'y1',
        'side': 'right'
    },

    margin={'l': 0, 'b': 40, 't': 40, 'r': 0},
            hovermode='closest',
        showlegend=False,
        ) }