3D Charts with Vizly
For data that needs an extra dimension (or just looks better in 3D), Vizly provides four 3D chart types backed by ECharts GL. The GL library loads only when a 3D chart is used, keeping the bundle lean for 2D-only pages. v1.0.1 accepts pd.DataFrame, list[dict], or dict[list] directly. Use chart.render('file.html') to write to a file or chart.to_html() for a string.
Bar chart 3D
Visualize 3D bar plots with X, Y, and Z axes.
import pandas as pd
import vizly as vz
vz.set_theme("corporate")
df = pd.DataFrame({
'x': [-1.0, -1.0, -1.0, -1.0, -0.3, -0.3, -0.3, -0.3,
0.4, 0.4, 0.4, 0.4, 1.0, 1.0, 1.0, 1.0],
'y': [-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0,
-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0],
'z': [0.111, -0.903, -0.971, -0.339, 0.226, -0.514, -0.608, -0.224,
0.204, 0.8, 0.579, -0.246, 0.339, 1.053, 0.821, -0.111],
})
chart = vz.bar3d(df, x='x', y='y', z='z', title='3D bars', theme='corporate')
chart.to_html()
Line chart 3D
Plot a 3D line path through space.
import pandas as pd
import vizly as vz
df = pd.DataFrame({
'x': [-1.0, -1.0, -1.0, -1.0, -0.3, -0.3, -0.3, -0.3,
0.4, 0.4, 0.4, 0.4, 1.0, 1.0, 1.0, 1.0],
'y': [-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0,
-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0],
'z': [0.111, -0.903, -0.971, -0.339, 0.226, -0.514, -0.608, -0.224,
0.204, 0.8, 0.579, -0.246, 0.339, 1.053, 0.821, -0.111],
})
chart = vz.line3d(df, x='x', y='y', z='z', title='3D path', theme='corporate')
Scatter chart 3D
Visualize data points in 3D space. Interactive rotate/zoom lets you explore relationships from every angle.
import pandas as pd
import vizly as vz
df = pd.DataFrame({
'x': [-1.0, -1.0, -1.0, -1.0, -0.3, -0.3, -0.3, -0.3,
0.4, 0.4, 0.4, 0.4, 1.0, 1.0, 1.0, 1.0],
'y': [-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0,
-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0],
'z': [0.111, -0.903, -0.971, -0.339, 0.226, -0.514, -0.608, -0.224,
0.204, 0.8, 0.579, -0.246, 0.339, 1.053, 0.821, -0.111],
})
chart = vz.scatter3d(df, x='x', y='y', z='z', title='3D scatter', theme='corporate')
Surface chart 3D
Plot a continuous 3D surface. Ideal for mathematical functions, terrain data, or response surfaces.
import pandas as pd
import vizly as vz
df = pd.DataFrame({
'x': [-1.0, -1.0, -1.0, -1.0, -0.3, -0.3, -0.3, -0.3,
0.4, 0.4, 0.4, 0.4, 1.0, 1.0, 1.0, 1.0],
'y': [-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0,
-1.0, -0.3, 0.4, 1.0, -1.0, -0.3, 0.4, 1.0],
'z': [0.111, -0.903, -0.971, -0.339, 0.226, -0.514, -0.608, -0.224,
0.204, 0.8, 0.579, -0.246, 0.339, 1.053, 0.821, -0.111],
})
chart = vz.surface3d(df, x='x', y='y', z='z', title='3D surface', theme='corporate')
Performance note
3D charts require ECharts GL (echarts-gl.min.js). Vizly loads this library only when a 3D chart is rendered, so 2D-only pages stay lean. The first 3D chart on a page triggers the GL script load.
# GL loads automatically on first use
chart = vz.scatter3d(df, x='x', y='y', z='z', title='3D scatter')
# Subsequent 3D charts reuse the same GL instance
3D chart overview
| Chart | Visual | Use case |
|---|---|---|
bar3d | 3D bars rising from a grid | Scientific data, 3D histograms |
line3d | 3D line path | Flight paths, trajectories, 3D time series |
scatter3d | Points in 3D space | Multi-variate clusters, particle systems |
surface3d | Continuous 3D surface | Terrain, response surfaces, mathematical functions |