raphaelquast / EOmaps

A library to create interactive maps of geographical datasets
https://eomaps.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
339 stars 25 forks source link

Creating colorbars on not yet visible layers results in axes size changes and requires re-draw of all cached layers! #245

Closed raphaelquast closed 3 months ago

raphaelquast commented 6 months ago

Describe the bug Cached layers must be re-drawn if a new colorbar is added that results in a change of the axes-sizes.

To Reproduce

from eomaps import Maps
m = Maps()
m.add_feature.preset.ocean()
m.f.canvas.draw()   # to draw and cache the layer

m2 = m.new_layer("not yet visible layer")
m2.set_data([1,2,3], [1,2,3], [1,2,3])
m2.plot_map(set_extent=False)
m2.add_colorbar()

Possible workaround:

Trigger an explicit re-draw after adding the colorbar

m.redraw()