ToggleΒΆ
Toggle
ΒΆ
Toggles act as a container that holds a list of nested Block objects, whose visibility can be toggled on or off by the report viewer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*arg_blocks
|
BlockOrPrimitive
|
Group to add to report |
()
|
blocks
|
list[BlockOrPrimitive] | None
|
Allows providing the report blocks as a single list |
None
|
name
|
str | None
|
A unique id for the blocks to aid querying (optional) |
None
|
label
|
str | None
|
A label used when displaying the block (optional) |
None
|
Simple ToggleΒΆ
import seaborn as sns
code = """
titanic = sns.load_dataset("titanic")
report = ar.Report(
"# Titanic overview",
ar.HTML(
'<html><img alt="No description has been provided for this image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/RMS_Titanic_3.jpg/1599px-RMS_Titanic_3.jpg" style="height:400px;display:flex;margin:auto"/></html>'
),
ar.Select(
blocks=[
ar.Table(titanic.describe(), label="Data Description"),
ar.DataTable(titanic, label="Whole Dataset"),
ar.Code(code, label="Source code"),
]
),
)
report.save(path="select.html")
"""
titanic = sns.load_dataset("titanic")
ar.Blocks(
"# Titanic overview",
ar.HTML(
'<html><img alt="No description has been provided for this image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/RMS_Titanic_3.jpg/1599px-RMS_Titanic_3.jpg" style="height:400px;display:flex;margin:auto"/></html>'
),
ar.Toggle(
blocks=[
ar.Table(titanic.describe(), label="Data Description"),
ar.DataTable(titanic, label="Whole Dataset"),
ar.Code(code, label="Source code"),
]
),
)