3
votes

I'm trying to resize a plotly graph in Dash made with figure factory. I know how to change the size in the layout of a regular graph.Obj in plotly, but that isn't working with my figure factory graph.

The graphing function that i'm trying to resize is:

fig_map = ff.create_choropleth(fips=df['x'].tolist(), 
   values=df['y'].tolist(), scope=[state],
   binning_endpoints=endpts,colorscale=DEFAULT_COLORSCALE,
   county_outline={'color': 'rgb(255,255,255)', 'width': 0.5}, 
   round_legend_values=True, legend_title='Population by County')

It seems like I want something like

fig_map.layout.update({'height':800}) 

from this page https://plot.ly/python/figure-factory-subplots/#plotlys-figure-factory-module, but get an error in my dash app when trying that. Also this does not change the size either:

fig_map={
  'layout': go.Layout(
    height=800,
    )}

Any suggestions would be great.

1

1 Answers

2
votes

You can try specify height in 'layout` or update him:

data=[fig_map]
layout = go.Layout(
      autosize=False,
      width=1000,
      height=1000,
      title="fig_map")
fig = go.Figure(data=data,layout=layout)
fig['layout'].update(width=500, height=500, autosize=False)
plotly.offline.plot(fig, filename='fig_map')