Plot Types¶
Overview of all available plot types.
In [1]:
Copied!
import plotly.express as px
import xarray as xr
from xarray_plotly import config, xpx
config.notebook()
import plotly.express as px
import xarray as xr
from xarray_plotly import config, xpx
config.notebook()
In [2]:
Copied!
# Sample data
df = px.data.stocks().set_index("date")
df.index = df.index.astype("datetime64[ns]")
stocks = xr.DataArray(
df.values,
dims=["date", "company"],
coords={"date": df.index, "company": df.columns.tolist()},
name="price",
)
# Sample data
df = px.data.stocks().set_index("date")
df.index = df.index.astype("datetime64[ns]")
stocks = xr.DataArray(
df.values,
dims=["date", "company"],
coords={"date": df.index, "company": df.columns.tolist()},
name="price",
)
area¶
In [3]:
Copied!
xpx(stocks).area()
xpx(stocks).area()
bar¶
In [4]:
Copied!
xpx(stocks.isel(date=[0, 25, 50, 75, 100])).bar()
xpx(stocks.isel(date=[0, 25, 50, 75, 100])).bar()
box¶
In [5]:
Copied!
xpx(stocks).box()
xpx(stocks).box()
imshow¶
In [6]:
Copied!
xpx(stocks).imshow()
xpx(stocks).imshow()
line¶
In [7]:
Copied!
xpx(stocks).line()
xpx(stocks).line()
pie¶
In [8]:
Copied!
xpx(stocks.isel(date=-1)).pie()
xpx(stocks.isel(date=-1)).pie()
scatter¶
In [9]:
Copied!
xpx(stocks).scatter()
xpx(stocks).scatter()