You can run this notebook in Binder, in Colab, in Deepnote or in Kaggle.

[1]:
!pip install --quiet climetlab
[2]:
%config Application.log_level="INFO"

More plotting examples

[3]:
import climetlab as cml

Get some GRIB data

[4]:
ds = cml.load_dataset("sample-grib-data")

Plot the first field

[5]:
cml.plot_map(ds[0])
../_images/examples_15-more-plotting_7_0.png

Plot the second field

[6]:
cml.plot_map(ds[1])
../_images/examples_15-more-plotting_9_0.png

Plot both fields on the same map

[7]:
cml.plot_map((ds[0], ds[1]))
../_images/examples_15-more-plotting_11_0.png

Alternative method:

[8]:
p = cml.new_plot()
p.plot_map(ds[0])
p.plot_map(ds[1])
p.show()
../_images/examples_15-more-plotting_13_0.png

Switch off background map

[9]:
cml.plot_map(ds[1], background=False)
../_images/examples_15-more-plotting_15_0.png

Switch off both foreground and background

[10]:
cml.plot_map(
    ds[1],
    foreground=False,
)
../_images/examples_15-more-plotting_17_0.png

Projections

[11]:
from climetlab.plotting import projections
[12]:
for projection in projections():
    cml.plot_map(projection=projection, title=projection)
../_images/examples_15-more-plotting_20_0.png
../_images/examples_15-more-plotting_20_1.png
../_images/examples_15-more-plotting_20_2.png
../_images/examples_15-more-plotting_20_3.png
../_images/examples_15-more-plotting_20_4.png
../_images/examples_15-more-plotting_20_5.png
../_images/examples_15-more-plotting_20_6.png
../_images/examples_15-more-plotting_20_7.png
../_images/examples_15-more-plotting_20_8.png
../_images/examples_15-more-plotting_20_9.png
../_images/examples_15-more-plotting_20_10.png
../_images/examples_15-more-plotting_20_11.png
../_images/examples_15-more-plotting_20_12.png
../_images/examples_15-more-plotting_20_13.png
../_images/examples_15-more-plotting_20_14.png
../_images/examples_15-more-plotting_20_15.png
../_images/examples_15-more-plotting_20_16.png
../_images/examples_15-more-plotting_20_17.png
../_images/examples_15-more-plotting_20_18.png
../_images/examples_15-more-plotting_20_19.png
../_images/examples_15-more-plotting_20_20.png
../_images/examples_15-more-plotting_20_21.png
../_images/examples_15-more-plotting_20_22.png
../_images/examples_15-more-plotting_20_23.png

Low-level graphical attributes

[13]:
cml.plotting_options(width=500)
[14]:
atlantic = cml.load_dataset("hurricane-database", bassin="atlantic")
[15]:
df = atlantic.to_pandas()
[16]:
david = df[(df.name == "david")]
[17]:
cml.plot_map(
    david, style=dict(symbol_colour="blue", symbol_type="marker", symbol_marker_index=3)
)
../_images/examples_15-more-plotting_26_0.png
[18]:
cml.plot_map(david)
../_images/examples_15-more-plotting_27_0.png
[19]:
cml.plot_map(david, style={"+symbol_colour": "blue"})
../_images/examples_15-more-plotting_28_0.png
[20]:
cml.plot_map(
    david,
    background={
        "map_coastline_land_shade": True,
        "map_coastline_land_shade_colour": "green",
    },
)
../_images/examples_15-more-plotting_29_0.png
[21]:
cml.plot_map(david, background=False)
../_images/examples_15-more-plotting_30_0.png