Hi,
What I want to do:
I have a div in Dash that is of fixed size. In it is displayed a Graph which is longer than the parent div. So I added an overflow y option to the parent div. Now, I would like for the Graph (bar chart) to be as “compressed” as possible. Meaning small bar width and low bargap. The reason for that is that I don’t want the user having to scroll for just 4-5 elements.
Here is an example from the plotly page which I modified slightly:
import plotly.graph_objects as go
years = [1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012]
fig = go.Figure()
fig.add_trace(go.Bar(x=years,
y=[219, 146, 112, 127, 124, 180, 236, 207, 236, 263,
350, 430, 474, 526, 488, 537, 500, 439],
name='Rest of world',
marker_color='rgb(55, 83, 109)',
width=0.1
))
fig.update_layout(
title='US Export of Plastic Scrap',
xaxis_tickfont_size=14,
yaxis=dict(
title='USD (millions)',
titlefont_size=16,
tickfont_size=14,
),
legend=dict(
x=0,
y=1.0,
bgcolor='rgba(255, 255, 255, 0)',
bordercolor='rgba(255, 255, 255, 0)'
),
barmode='group',
bargap=0, # gap between bars of adjacent location coordinates.
)
fig.show()
The width reduction works but not the bargap.