xrview.html.HtmlPlot

class xrview.html.HtmlPlot(data, x, overlay='dims', coords=None, glyphs='line', title=None, share_y=False, tooltips=None, tools=None, toolbar_location='right', figsize=600, 300, ncols=1, palette=None, ignore_index=False, theme=None, **fig_kwargs)[source]

Base class for HTML plots.

Examples

import numpy as np
import xarray as xr
from xrview.html import HtmlPlot

x = np.linspace(0, 1, 100)
y = np.sqrt(x)
da = xr.DataArray(y, coords={'x': x}, dims='x')

plot = HtmlPlot(da, x='x')
plot.show()
__init__(data, x, overlay='dims', coords=None, glyphs='line', title=None, share_y=False, tooltips=None, tools=None, toolbar_location='right', figsize=600, 300, ncols=1, palette=None, ignore_index=False, theme=None, **fig_kwargs)

Constructor.

Parameters
dataxarray DataArray or Dataset

The data to display.

xstr

The name of the dimension in data that contains the x-axis values.

glyphsstr, BaseGlyph or iterable, default ‘line’

The glyph to use for plotting.

figsizeiterable, default (600, 300)

The size of the figure in pixels.

ncolsint, default 1

The number of columns of the layout.

overlay‘dims’ or ‘data_vars’, default ‘dims’

If ‘dims’, make one figure for each data variable and overlay the dimensions. If ‘data_vars’, make one figure for each dimension and overlay the data variables. In the latter case, all variables must have the same dimensions.

tooltipsdict, optional

Names of tooltips mapping to glyph properties or source columns, e.g. {'datetime': '$x{%F %T.%3N}'}.

toolsstr, optional

bokeh tool string.

paletteiterable, optional

The palette to use when overlaying multiple glyphs.

ignore_indexbool, default False

If True, replace the x-axis values of the data by an appropriate evenly spaced index.

Methods

__init__(data, x[, overlay, coords, glyphs, …])

Constructor.

add_annotation(annotation[, onto])

Add an annotation to a figure in the layout.

add_figure(data[, glyphs, coords, name])

Add a figure to the layout.

add_overlay(data[, glyphs, coords, name, onto])

Add an overlay to a figure in the layout.

copy([with_data])

Create a copy of this instance.

export(filename[, mode])

Export the layout as as png or svg file.

make_doc()

Make the document.

make_layout()

Make the layout.

modify_figures(modifiers[, figures])

Modify the attributes of a figure.

show([filename, remake_layout])

Show the plot in an HTML file.

Attributes

default_tools