-
-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
Hi,
Really excited about the direction of this package.
I would like to display the outputs within a static html i.e. one produced with Quarto. I wasn't able to get the output to show using the Jupyter Widget. Is this use case possible? If not, is this something that could work in future?
quarto render test.ipynb --execute
test.ipynb -
import pandas as pd
from mosaic_widget import MosaicWidget
weather = pd.read_csv("https://uwdata.github.io/mosaic-datasets/data/seattle-weather.csv", parse_dates=['date'])
spec = {
"params": {
"click": { "select": "single" },
"domain": ["sun", "fog", "drizzle", "rain", "snow"],
"colors": ["#e7ba52", "#a7a7a7", "#aec7e8", "#1f77b4", "#9467bd"]
},
"vconcat": [
{
"hconcat": [
{
"plot": [
{
"mark": "dot",
"data": { "from": "weather", "filterBy": "$click" },
"x": { "dateMonthDay": "date" },
"y": "temp_max",
"fill": "weather",
"r": "precipitation",
"opacity": 0.7
},
{ "select": "intervalX", "as": "$range" },
{ "select": "highlight", "by": "$range", "fill": "#eee" },
{ "legend": "color", "as": "$click", "columns": 1 }
],
"xyDomain": "Fixed",
"xTickFormat": "%b",
"colorDomain": "$domain",
"colorRange": "$colors",
"rDomain": "Fixed",
"rRange": [2, 10],
"width": 800
}
]
},
{
"plot": [
{
"mark": "barX",
"data": { "from": "weather" },
"x": { "count": None },
"y": "weather",
"fill": "#f5f5f5"
},
{
"mark": "barX",
"data": { "from": "weather", "filterBy": "$range" },
"x": { "count": None },
"y": "weather",
"fill": "weather",
"order": "weather"
},
{ "select": "toggleY", "as": "$click" },
{ "select": "highlight", "by": "$click" }
],
"xDomain": "Fixed",
"yDomain": "$domain",
"yLabel": None,
"colorDomain": "$domain",
"colorRange": "$colors",
"width": 800
}
]
}
MosaicWidget(spec, data = {"weather": weather})
Metadata
Metadata
Assignees
Labels
No labels