-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugsomething brokensomething broken
Milestone
Description
Hi Plotly Team,
I may have stumbled across an inconsistency in the api for the bar chart trace. I have gotten used to be able to pass pandas series to trace properties. However assigning the width of a bar chart does not work as expected if a pandas series is passed - the trace is not displayed. A simple example to reproduce the behavior in a Jupyter Notebook is provided below.
import pandas as pd
import plotly.graph_objs as go
df = pd.DataFrame({
'Group': [1, 2, 3],
'Height': [3, 2, 1],
'Width': [0.1, 0.2, 0.3],
})
traces = [
go.Bar(
x=df['Group'],
y=df['Height'],
width=df['Width'].tolist(),
xaxis='x',
),
go.Bar(
x=df['Group'],
y=df['Height'],
width=df['Width'],
xaxis='x2',
),
]
layout = go.Layout(
xaxis={'domain': [0, 0.48]},
xaxis2={'domain': [0.52, 1]},
)
go.FigureWidget(
data=traces,
layout=layout,
)
While the workaround is quite simple, it might be worth considering to make it work with pandas series as well.
Thanks for this great library!
Metadata
Metadata
Assignees
Labels
bugsomething brokensomething broken