Charts — vx.plot()
v0.3.0One call for every chart: 14 kinds, interactive (Plotly) or static (matplotlib), with automatic kind inference from dtypes, downsampling for large datasets and WebGL acceleration.
Basic Usage
Pass a DataFrame and the aesthetics. When kind is omitted, ViewX infers the best chart type from the column dtypes. The returned Chart object exposes .save(), .show() and the underlying figure in .fig.
charts.py
python
import viewx as vx
df = vx.load_dataset("iris.csv")
# Interactive (Plotly) — renders itself in notebooks
vx.plot(df, x="sepal_length", y="petal_length", title="Sepal vs Petal")
# Kind inferred from dtypes: categorical x + numeric y -> bar
vx.plot(df, x="species", y="petal_length")
# Static (matplotlib) for papers / PDFs
vx.plot(df, kind="histogram", x="sepal_length", static=True).save("hist.png")Available Kinds
| Kind | Use case |
|---|---|
| line | Trends over an ordered axis (dates, indexes) |
| bar | Categorical comparisons (vertical) |
| bar_h | Categorical comparisons (horizontal) |
| scatter | Relationship between two numeric variables |
| area | Cumulative trends over an ordered axis |
| pie | Proportions of a whole |
| donut | Proportions of a whole (ring) |
| histogram | Distribution of one numeric variable |
| box | Distribution groups with quartiles/outliers |
| violin | Distribution groups with density |
| heatmap | Matrix values (correlations, pivots) |
| funnel | Stage-to-stage drop-off |
| treemap | Hierarchical proportions |
| bubble | Scatter weighted by size |
API Reference
plot
plot(data, kind=None, x=None, y=None, z=None, static=False, title=None, **kwargs) -> Chart
Chart
Chart.save
chart.save(path, **kwargs)
Chart.show
chart.show()
Large Datasets
vx.plot is built for real-world data sizes:
Downsampling — datasets over 10k points are sampled before rendering so the browser stays fast.
WebGL — scatter charts over 5k points automatically switch to WebGL rendering (scattergl).