Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Image: ubuntu2204
Importing the necessary module
Import the Map
and Marker
classes from the ipyleaflet
library:
Setting map center
Define the center coordinates of the map. Latitude is 52.204793 and longitude is 360.121558:
Creating the map
Create a map centered at the given coordinates with a zoom level of 12. A higher zoom level means zooming in closer to the map:
Adding a draggable marker
Add a draggable Marker
to the map. This allows updating the marker's location by dragging it on the map:
Displaying the map
Use the display
function to show the map with the draggable marker:
Updating marker location
Update the marker's location from Python. This can simulate interactions or programmatic updates:
Observing marker location changes
Define a function that will be triggered when the marker's location changes. This function can be used, for example, to print the new location:
Connect the function on_location_changed
to changes in the marker's location:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[21], line 30
28 ax.set_zlabel("Z")
29 plt.title("Lorenz Attractor")
---> 30 plt.sow()
AttributeError: module 'matplotlib.pyplot' has no attribute 'sow'