-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
The speed of plotting a histogram of a large DataArray depends a lot how you do it:
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
nPoints = 100000
data = xr.DataArray(np.random.random(nPoints),dims=['time'],coords=[np.arange(nPoints)])
It take sonly some ms if you use
plt.figure()
%time data.plot.hist()
plt.figure()
%time plt.hist(data.values)
However, if you omit .values
it takes extremely long:
In [12]: %time plt.hist(data)
CPU times: user 2min, sys: 9.73 s, total: 2min 9s
Wall time: 2min 3s
Do if one forgets to add .values
or to use xarray's plot routine, one can be stuck for a long time. I have to kill python 1-2 per day due to that issue.
Metadata
Metadata
Assignees
Labels
No labels