How to re-size Choropleth maps

Hi,
I’m trying to modify the size of the following example. But It keeps always in the same square size.

df = px.data.election()
geojson = px.data.election_geojson()

fig = px.choropleth(df, geojson=geojson, color=“winner”,
locations=“district”, featureidkey=“properties.district”,
projection=“mercator”, hover_data=[“Bergeron”, “Coderre”, “Joly”]
)
fig.update_geos(fitbounds=“locations”, visible=False)
fig.update_layout(margin={“r”:0,“t”:0,“l”:0,“b”:0})
fig.show()

I’m new in plotly, many thanks in advance.

Hi @jesonora
My solution wasn’t perfect but it helped me resize the map a little:

fig.update_layout(margin=dict(l=60, r=60, t=50, b=50))

Hope this helps,

Hi @adamschroeder,

Even with your solution I’m not able to change the size of the map.

Thansks,

I was my mistake about the projection feature.

I too. I had tried everything. In the end I discovered that somehow the map ratio was fixed because I was using the “mercator” projection. I played a bit with different projections and ended up having a wider map (layout.geo | Python | Plotly).

I also used:

w.update_layout(
        autosize=False,
        margin = dict(
                l=0,
                r=0,
                b=0,
                t=0,
                pad=4,
                autoexpand=True
            ),
            width=800,
        #     height=400,
    )