# Setting "base" in barplot does not work

**URL:** <https://community.plotly.com/t/setting-base-in-barplot-does-not-work/8040>\
**Category:** 📊 Plotly Python\
**Created:** [January 30, 2018, 1:19pm UTC](https://community.plotly.com/t/setting-base-in-barplot-does-not-work/8040 "2018-01-30T13:19:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebedm](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sebedm](https://community.plotly.com/u/sebedm)\
**Post date:** [January 30, 2018, 1:19pm UTC](https://community.plotly.com/t/setting-base-in-barplot-does-not-work/8040/1 "2018-01-30T13:19:22Z")

</div>

Hello I have the following problem

When trying to set a “base” in a barplot i.e I want bar k span between value i and j  
but all I get is that bar k span from the start of the bar with lowest base…

To exemplify, here is my example data

```
Event Finish Start Unit

```

0 Active 2010-01-01 15:00:00 2010-01-01 01:00:00 Unit1  
1 Active 2010-01-01 16:00:00 2010-01-01 05:00:00 Unit2  
2 Active 2010-01-01 17:00:00 2010-01-01 07:00:00 Unit3

bar 0 span from start0 to finish0, no problem  
bar 1 span from start0 to finish1, problem  
etc…

The purpose is to make something similar to a gantt scheme and I’ve tried create\_gantt from figure factory  
but it did not quite fulfilled my demands.

The following code is used to reproduce the problem and are an part of a larger code but enough for reproduce…

Thank you!

import dash  
import dash\_core\_components as dcc  
import dash\_html\_components as html  
import plotly.graph\_objs as go  
import pandas as pd

#simulated active  
unit = [‘Unit1’,‘Unit2’,‘Unit3’]  
event = [‘Active’,‘Active’,‘Active’]  
start = [‘2010-01-01 01:00:00’,‘2010-01-01 05:00:00’,‘2010-01-01 07:00:00’]  
finish = [‘2010-01-01 15:00:00’,‘2010-01-01 16:00:00’,‘2010-01-01 17:00:00’]  
df\_active = pd.DataFrame({‘Unit’:unit,‘Start’:start,‘Finish’:finish,‘Event’:event})

df\_base=df\_active  
print df\_base

traces=[]

for i in range(len(df\_base)):

```
trace0 = go.Bar(
y=[df_base['Unit'].loc[i],df_base['Unit'].loc[i]],
x=[df_base['Start'].loc[i],df_base['Finish'].loc[i]],
orientation = 'h',
marker=dict(
    color='green'
            ),
name='task active',
hoverinfo = "text",
text = 'start'+' '+df_base['Start'].loc[i]

)

traces.append(trace0)

```

data = traces  
layout=go.Layout(barmode=‘overlay’,xaxis=dict(type=‘date’))

app = dash.Dash()

app.layout = html.Div(  
[  
dcc.Graph(id=‘gantt’,figure={‘data’:data,‘layout’:layout})  
]

)

if **name** == ‘ **main** ’:  
app.run\_server(debug=True)
