[Feature Request | Bug Report] Plot Area / Colorbar Size Variance (Geos)

Hi there,

I am using Plotly for an application of mine and I am having trouble matching the size of the color bar to the size of the plot area itself. I want my code to do this automatically.

I am using the Plotly graph objects API in order to do this.

I am noticing variance in the size of the plot area which doesnโ€™t let me modify the color bar properties in my code easily.

I believe this plot area size variance to be a bug? If we could change the size of the plot area independently from the figure size, that would be an excellent feature as well.

I have an example of this variance using GeoPandas, which I tried to make as short as possible:

from plotly.graph_objs import Choropleth, Figure
import geopandas as gpd
import json

gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf['value_field'] = 0

# first figure: hone in on canada
canada_gdf = gdf[gdf['name'] == 'Canada']
choro = Choropleth(geojson=json.loads(canada_gdf.to_json()), z=canada_gdf['value_field'], locations=canada_gdf.index)

fig = Figure()
fig.update_layout(margin=dict(b=5, t=5, l=5, r=5), height=600, width=800)
fig.add_trace(choro)
fig.update_geos(projection_type='orthographic', lataxis_range=[40, 90], lonaxis_range=[-145, - 50], projection_rotation=dict(lat=62, lon=-96))
fig.show()

# second figure: hone in on france
france_gdf = gdf[gdf['name'] == 'France']
choro = Choropleth(geojson=json.loads(france_gdf.to_json()), z=france_gdf['value_field'], locations=france_gdf.index)

fig = Figure()
fig.update_layout(margin=dict(b=5, t=5, l=5, r=5), height=600, width=800)
fig.add_trace(choro)
fig.update_geos(projection_type='orthographic', lataxis_range=[40, 60], lonaxis_range=[-10, 20], projection_rotation=dict(lat=46, lon=2.5))
fig.show()

There is variance between the plot area sizes. I want to know if I can keep the plot area size constant, or retrieve the dimensions of the plot area. All in all, I want to know how to keep figures fairly consistent in size, match the height of the colorbar with the height of the plot area, and minimize the distance between the plot area and colorbar.

You may see the plot area variance in a similar GitHub issue I made here: