alextc
alextc

Reputation: 3515

matplotlib does not show any plot window with xarray's plot() on Python 3.6.5

I was trying to plot with matplotlib and xarray on Python 3.6.5.

My code is actually from the xarray documentation:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import xarray as xr

airtemps = xr.tutorial.open_dataset('air_temperature')
print(airtemps)

air = airtemps.air - 273.15
air.attrs = airtemps.air.attrs
air.attrs['units'] = 'deg C'
air1d = air.isel(lat=10, lon=10)
air1d.plot()      # using xarray.DataArray's plot()

When I ran the code (within the virturlenv) it didn't show any plotting window and no error was thrown.

Upvotes: 0

Views: 1082

Answers (1)

alextc
alextc

Reputation: 3515

My mistake I forgot to call plt.show() at the end.

Upvotes: 1

Related Questions