Skip to content

Error bars on bar traces should adhere to 'tozero' findExtreme option #3029

Description

@henrykeithturner

Hi all,

I've been greatly enjoying using plotly but I've run into the following problem which I've been told may be a bug. When i have a couple of small bars on a bar chart, adding error bars (which do not extend to the negative region) causes a large whitespace between the xaxis and the xticks - as shown below with the accompanying script:

A = [10, 8, 12, 5, 8]
B = [0.5, 0.4, 10, 0.1, 0.4]
A_error = [1, 2, 1, 1, 2]
B_error = [0.2, 0.2, 2, 0.05, 0.2]
x_data = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']


trace1 = (py.graph_objs.Bar(x = x_data, y = A,
                            error_y = dict(type = 'data', array = A_error, visible = True), 
                            hoverinfo = 'x + y', name = 'A', opacity = 0.8, hoverlabel = dict(font = dict(size = 20))))    

trace2 = (py.graph_objs.Bar(x = x_data, y = B,
                            error_y = dict(type = 'data', array = B_error, visible = True), 
                            hoverinfo = 'x + y', name = 'B', opacity = 0.8, hoverlabel = dict(font = dict(size = 20))))   

data = [trace1, trace2]


layout = py.graph_objs.Layout(

    autosize = False,
    width = 1700,
    height = 1000,
    margin = dict(b = 100),
    showlegend = True,
    legend=dict(x=1, y=0.85, font = dict(size = 20), bgcolor = 'rgba(0,0,0,0)', bordercolor = 'black', borderwidth = 1),
    title = ('tick test'),
    titlefont = dict(size = 40),
        xaxis=dict(
            title  = 'x_variable',
        ticks = 'outside',
        tickwidth = 2, 
        titlefont = dict(
            size = 25),    
        tickfont=dict(
            size=15,
        ),
            tickangle = 270,
            automargin = True,
        ),

    yaxis=dict(
            title  = ('y_data'),
        ticks = 'outside',
        tickwidth = 2,
        titlefont = dict(
            size = 25),
        tickfont=dict(
            size=15,

        ),
            hoverformat = '.2f',
            automargin = True,


        ),    

)


fig = py.graph_objs.Figure(data=data, layout=layout)
py.offline.iplot(fig) 

plotly_tick_reproducible

The whitespace dissappears when I remove orange bars. There are more details in the link I first made below

https://community.plot.ly/t/large-white-space-between-xaxis-and-xticks/13739/3

Thanks,

Harry T

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions