xarray
xarray copied to clipboard
Add LineCollection plot
This adds a line plotter based on LineCollections
, called .lines
.
I wanted to replace darray.plot()
with using LineCollection instead. But unfortunately due to how many cases are supported (and tested in xarray) darray.plot()
will continue using plt.plot
.
xref: #4820 #5622
Scatter vs. Lines:
ds = xr.tutorial.scatter_example_dataset(seed=42)
hue_ = "y"
x_ = "y"
size_="y"
z_ = "z"
fig = plt.figure()
ax = fig.add_subplot(1, 2, 1, projection='3d')
ds.A.sel(w="one").plot.lines(x=x_, z=z_, hue=hue_, linewidth=size_, ax=ax)
ax = fig.add_subplot(1, 2, 2, projection='3d')
ds.A.sel(w="one").plot.scatter(x=x_, z=z_, hue=hue_, markersize=size_, ax=ax)