Skip to content

xaxis tick text alignment is differs for different graphs #1982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mnkami opened this issue Sep 2, 2017 · 1 comment
Closed

xaxis tick text alignment is differs for different graphs #1982

mnkami opened this issue Sep 2, 2017 · 1 comment

Comments

@mnkami
Copy link

mnkami commented Sep 2, 2017

Bar and Line charts withLayouts:

line_layout = go.Layout(
        xaxis={
            'color': '#BFC4CB',
            'showgrid': False,
            'type': 'category',
        },
        yaxis={
            'color': '#BFC4CB',
            'gridcolor': '#1E3550',
            'type': 'linear',
            'zeroline': False,
            'fixedrange': True,
            'autorange': False,
            'tickformat': '.0%',
            'range': [0, 0.51]
        },
        height=300,
        margin={'l': 40, 'b': 40, 't': 10, 'r': 0},
        hovermode=False,
        showlegend=False,
        paper_bgcolor='rgb(24, 44, 68)',
        plot_bgcolor='rgb(24, 44, 68)'
    )

bar_layout = go.Layout(
        xaxis={
            'color': '#BFC4CB',
            'showgrid': False,
            'type': 'category',
        },
        yaxis={
            'color': '#BFC4CB',
            'gridcolor': '#1E3550',
            'zeroline': False
        },
        height=200,
        margin={'l': 40, 'b': 40, 't': 10, 'r': 0},
        hovermode=False,
        showlegend=False,
        paper_bgcolor='rgb(24, 44, 68)',
        plot_bgcolor='rgb(24, 44, 68)',
        barmode='group',
        bargap=0.55,
        bargroupgap=0
    )

and data

bar = go.Bar(
        y=[2,3,4,5,6,3,2,5,7,4,3,5],
        x=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        width=0.1,
        marker=dict(
            color=('#da934e'),
        )
    )

line = go.Scatter(
        x=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        y=[0, 0.2, 0.3, 0.4, 0.5, 0.3, 0.4, 0.5, 0.3, 0.4, 0.5, 0],
        connectgaps=True,
        line=dict(
            color=('#da934e')
        )
    )

Has different margins on tick0
screen shot 2017-09-02 at 17 58 49

@etpinard
Copy link
Contributor

etpinard commented Sep 5, 2017

Yes, that's intended. scatter traces with the 'markers' mode turned on expand the axis ranges a little more than the bar traces.

See #1927, #1775, #1757 and #1876

If you don't like the range defaults that plotly gives you, simply set xaxis.range to the value of your liking.

@etpinard etpinard closed this as completed Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants