128 add widget
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install -U geemap
# !pip install -U geemap
In [ ]:
Copied!
import geemap
import geemap
Add text.
In [ ]:
Copied!
m = geemap.Map()
text = 'Hello World'
m.add_text(text, position='bottomright')
m
m = geemap.Map()
text = 'Hello World'
m.add_text(text, position='bottomright')
m
Customize text style.
In [ ]:
Copied!
m = geemap.Map()
text = 'Hello World'
params = {
'fontsize': 30,
'fontcolor': 'blue',
'bold': True,
'padding': '10px',
'background': True,
'bg_color': 'white',
'border_radius': '5px',
'position': 'bottomright',
}
m.add_text(text, **params)
m
m = geemap.Map()
text = 'Hello World'
params = {
'fontsize': 30,
'fontcolor': 'blue',
'bold': True,
'padding': '10px',
'background': True,
'bg_color': 'white',
'border_radius': '5px',
'position': 'bottomright',
}
m.add_text(text, **params)
m
Add image.
In [ ]:
Copied!
m = geemap.Map()
image = 'https://i.imgur.com/LmTETPX.png'
m.add_image(image, position='bottomright')
m
m = geemap.Map()
image = 'https://i.imgur.com/LmTETPX.png'
m.add_image(image, position='bottomright')
m
Add HTML.
In [ ]:
Copied!
m = geemap.Map()
html = """
<h2>Jupyter Logo</h2>
<img src="https://i.imgur.com/LmTETPX.png">
"""
m.add_html(html, position='bottomright')
m
m = geemap.Map()
html = """
Jupyter Logo
""" m.add_html(html, position='bottomright') mAdd widget.
In [ ]:
Copied!
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
In [ ]:
Copied!
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots(figsize=(4, 3))
ax.plot(t, s)
ax.set(
xlabel='time (s)', ylabel='voltage (mV)', title='About as simple as it gets, folks'
)
ax.grid()
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots(figsize=(4, 3))
ax.plot(t, s)
ax.set(
xlabel='time (s)', ylabel='voltage (mV)', title='About as simple as it gets, folks'
)
ax.grid()
In [ ]:
Copied!
m = geemap.Map()
m.add_widget(fig, position='bottomright')
m
m = geemap.Map()
m.add_widget(fig, position='bottomright')
m