✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

How to show int instead of decimal in graph

Just wondering how do I setup so that only int showing up on vertical axis instead of decimal, cuz all of my data basically is int not decimal.

upload

Hi @Brandon

You can just use dtick = 1 https://plot.ly/python/reference/#layout-yaxis-dtick For an example of tick placement and other axes styling options see https://plot.ly/python/axes/#tick-placement-color-and-style

Hi @bcd, thanks for the reply, however, I am using dash not plotly library and my code is like this:

dcc.Graph(
                    id='example-graph',
                    figure={
                        'data': [
                            go.Scatter(x=x, y=y, mode='lines+markers',
                                       marker={
                                           'size': 15,
                                           'opacity': 0.5,
                                           'line': {'width': 0.5, 'color': 'white'}
                                       }),
                        ],
                        'layout': {
                            'title': 'example',
                            'height': 350,
                            'width': '100%',
                            'yaxis': {'type': 'linear'},
                            'xaxis': {'showgrid': False}
                        }
                    }
                )

Could you show me how to do it using dash?

Thanks,

The syntax is the same across both libraries.