Black Lives Matter. Please consider donating to Black Girls Code today.

Is it possible to set the format and the start point at yaixs in dcc.Graph?

Hi guys,

I am trying to build dashboard based on Dash and Plotly. While currently, I encounter an annoying problem. It possible to set the format and start point at the yaixs? This is my part of codes.

dcc.Graph(
                    id='proportion_success_line_chart',
                    figure={
                        'data': [
                            {
                                'x': data['x'],
                                'y': data['y'] ,
                                'text': data['text'],
                                'name': 'XXX',
                                'mode': 'lines+markers'
                            }
                        ],
                        'layout': {
                            'xaxis': {'title': 'XXX'},
                            'yaxis': {'title': 'YYY', 'tickformat': "00.2%",
                                      'tickvals': [0.7+x*0.05 for x in range(6)]},
                            'margin': {'l': 60, 'b': 30, 't': 10, 'r': 0},
                            'height': 450,
                            'hovermode': 'closest',
                            'clickmode': 'event+select'
                        }
                    }

                )

Why ‘tickvals’ doesn’t work in that code? Since the yaxis shows the percentage, I hope it could start at 70% so that the whole graph will look nice. Thank you for your guys help.

Hi @RavenCrown, I believe you also have to fix the yaxis range here: https://plot.ly/javascript/axes/#setting-the-range-of-axes-manually