squirrels.dashboards or the squirrels module.
Constructor
Creates aPngDashboard object.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Dashboard in PNG format
squirrels.dashboards or the squirrels module.
PngDashboard object.
def __init__(
self, content: matplotlib.figure.Figure | io.BytesIO | bytes
) -> None:
Hide arguments
from squirrels.dashboards import PngDashboard
from squirrels.arguments import DashboardArgs
import matplotlib.pyplot as plt
import polars as pl
async def main(sqrl: DashboardArgs) -> PngDashboard:
# Get dataset
df = await sqrl.dataset("sales_data")
# Create matplotlib figure
fig, ax = plt.subplots(figsize=(10, 6))
# Plot data
pandas_df = df.to_pandas()
pandas_df.plot(x='date', y='revenue', ax=ax)
ax.set_title('Sales Revenue Over Time')
ax.set_xlabel('Date')
ax.set_ylabel('Revenue ($)')
# Return as PngDashboard
return PngDashboard(content=fig)
Was this page helpful?