Skip to content

Commit

Permalink
Add support for transparent legend
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jul 8, 2023
1 parent 6cbc06f commit bc497cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion geemap/geemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ def add_colorbar(
'cmap keyword or "palette" key in vis_params must be provided.'
)

_, ax = plt.subplots(figsize=(width, height))
fig, ax = plt.subplots(figsize=(width, height))
cb = mpl.colorbar.ColorbarBase(
ax, norm=norm, alpha=alpha, cmap=cmap, orientation=orientation, **kwargs
)
Expand All @@ -1148,6 +1148,10 @@ def add_colorbar(
ax.set_axis_off()
ax.tick_params(labelsize=font_size)

# set the background color to transparent
if transparent_bg:
fig.patch.set_alpha(0.0)

output = widgets.Output()
colormap_ctrl = ipyleaflet.WidgetControl(
widget=output,
Expand Down

0 comments on commit bc497cf

Please sign in to comment.