Skip to content Skip to sidebar Skip to footer

Plotting Data Points Onto Matplotlib Basemap In Jupyter Notebook

Link to full code I am able to successfully create a Basemap of the US within a Jupyter Notebook complete with shapefile, coloring, and borders in Cell 4. I am trying to plot many

Solution 1:

A. using a figure instance

The idea can be to explicitely specify the axes to plot to at Basemap creation.

Cell 1:

fig, ax = plt.subplots()
m = Basemap(... , ax=ax)

Cell 2: # do other stuff

Cell 3:

# plot to map:
m.plot(...)

Cell 4:

# state figureobjectto show figure (when inline backend is in use) 
fig


Screenshot of example:

enter image description here

B. let pyplot not close figures

The other option would be to let pyplot not close the figures. This is the second option from this answer: How to overlay plots from different cells?

%config InlineBackend.close_figures=False

enter image description here

Post a Comment for "Plotting Data Points Onto Matplotlib Basemap In Jupyter Notebook"