Skip to main content
The data explorer provides an interactive way to quickly visualize and understand your datasets with automatically generated charts.

Overview

mo.ui.data_explorer() creates an interactive visualization tool that:
  • Suggests appropriate chart types based on your data
  • Allows drag-and-drop encoding of visual channels
  • Updates visualizations in real-time
  • Works with pandas, polars, and other dataframe libraries

Basic Usage

The data explorer appears with:
  • Chart type selector (bar, line, scatter, etc.)
  • Encoding channels (x, y, color, size, etc.)
  • Interactive preview

Pre-configured Charts

Start with specific encodings:

Available Encodings

The data explorer supports multiple visual encodings:

Position

  • x - X-axis position
  • y - Y-axis position
  • row - Facet by row
  • column - Facet by column

Marks

  • color - Color encoding
  • size - Size of marks
  • shape - Shape of points

Example: Multi-dimensional Visualization

Accessing the Chart Specification

Retrieve the chart configuration:
In another cell:

Supported Data Types

The data explorer works with any dataframe library supported by narwhals:

Chart Types

The data explorer automatically suggests appropriate chart types based on your data and selected encodings:
  • Bar charts - For categorical comparisons
  • Line charts - For temporal data
  • Scatter plots - For correlations
  • Histograms - For distributions
  • Box plots - For statistical summaries
  • Heatmaps - For matrix data
Users can override the suggested type using the chart type selector in the UI.

Interactive Features

Reactive Updates

The data explorer is reactive - when the input dataframe changes, the visualization automatically updates:
In another cell:

Combining with Other UI Elements

Create dashboards by combining the data explorer with other components:
In another cell:

Performance Considerations

For large datasets (100k+ rows), the data explorer uses sampling to maintain interactivity.
  • Data is automatically sampled for preview
  • Full dataset is used for aggregations
  • Consider pre-aggregating very large datasets

Under the Hood

The data explorer uses:
  • Vega-Lite for declarative visualizations
  • Altair (via marimo’s chart transformer) for efficient rendering
  • CSV data transformation for browser compatibility

Example: Sales Dashboard

Users can now:
  • Switch to different chart types
  • Add faceting by region
  • Change aggregation methods
  • Explore temporal patterns
All without writing any visualization code!

Comparison with Other Tools

Use the data explorer for quick exploration, then switch to mo.ui.altair_chart() or mo.ui.plotly() for production visualizations.

Tips

Fast Exploration: Use the data explorer when you first receive a dataset to understand its structure and relationships.
Prototyping: Quickly prototype visualizations before writing custom chart code.
Presentations: Great for interactive demos where the audience can explore data live.

Limitations

  • Chart customization is limited compared to programmatic approaches
  • Complex visualizations may require mo.ui.altair_chart() or mo.ui.plotly()
  • No direct access to underlying Vega-Lite specification for modification
For advanced use cases, consider combining the data explorer for initial exploration with custom charts for final presentation.