'How to add title when I use xarray to plot

I use 'xarray' to read nc file and plot a figure. I achieved the figure, but I don't know how to modify the title of the figure. Please see the code below.

import xarray as xr
ds = xr.open_dataset('/users/james/Downloads/_data2/test2.nc')
ds['u10'].sel(latitude=-1.3,longitude=50.7,method='nearest').plot()

I hope someone could help me, thank you!



Solution 1:[1]

It's the same as how you use matplotlib as Mike said in the comment.

For your case, just use plt.title('your title').

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yu-Fen