Overlays

This is a notebook demonstrating how to overlay multiple plots on a single set of axes, including the use of coastlines.


In [ ]:
import iris
import iris.plot as iplt
import matplotlib.pyplot as plt

from cube_browser import Contour, Browser, Contourf, Pcolormesh

In [ ]:
cube1 = iris.load_cube(iris.sample_data_path('GloSea4/ensemble_001.pp'))
cube2 = iris.load_cube(iris.sample_data_path('GloSea4/ensemble_002.pp'))
print cube1
print cube2
  • First, set up your map projection and axes (with any additions such as coastlines).
  • Overlay the plots by specifying the same set of axes in the plot constructions.
  • Finally, display the plot.

In [ ]:
projection = iplt.default_projection(cube1)
fig = plt.figure(figsize=(12, 6))
ax = fig.add_subplot(111, projection=projection)
ax.coastlines()

plot1 = Contourf(cube1, ax)
plot2 = Contour(cube2, ax, cmap='viridis')

Browser([plot1, plot2]).display()