MuhammadLab
Machine Learning3D visualisationTriSurfacezoo_data.csvBrowser-based

Zoo Data TriSurface 3D Visualization

Draw a trisurface plot for 3D visualization on zoo_data.csv, inspect the surface, and learn how to interpret the graph.

A trisurface plot connects scattered 3D data points with triangles. It is useful when the data is not arranged in a perfect grid, which is common in real datasets.

Dataset and variables

Current dataset: Built-in zoo_data.csv sample

Upload zoo_data.csv or another CSV

Accepted: .csv, .tsv, .txt. Processed locally in the browser.

Rows

32

Numeric columns

17

Valid points

32

Interactive trisurface plot

legs + class_type + catsize

aardvark: legs=4, class_type=1, catsize=1antelope: legs=4, class_type=1, catsize=1bass: legs=0, class_type=4, catsize=0bear: legs=4, class_type=1, catsize=1boar: legs=4, class_type=1, catsize=1catfish: legs=0, class_type=4, catsize=0chicken: legs=2, class_type=2, catsize=0crow: legs=2, class_type=2, catsize=0dogfish: legs=0, class_type=4, catsize=1dolphin: legs=0, class_type=1, catsize=1duck: legs=2, class_type=2, catsize=0elephant: legs=4, class_type=1, catsize=1frog: legs=4, class_type=5, catsize=0fruitbat: legs=2, class_type=1, catsize=0giraffe: legs=4, class_type=1, catsize=1goat: legs=4, class_type=1, catsize=1gorilla: legs=2, class_type=1, catsize=1hawk: legs=2, class_type=2, catsize=0honeybee: legs=6, class_type=6, catsize=0lion: legs=4, class_type=1, catsize=1lobster: legs=6, class_type=7, catsize=0moth: legs=6, class_type=6, catsize=0octopus: legs=8, class_type=7, catsize=1penguin: legs=2, class_type=2, catsize=1pitviper: legs=0, class_type=3, catsize=0sealion: legs=2, class_type=1, catsize=1seasnake: legs=0, class_type=3, catsize=0seawasp: legs=0, class_type=7, catsize=0slug: legs=0, class_type=7, catsize=0swan: legs=2, class_type=2, catsize=1tortoise: legs=4, class_type=3, catsize=1wasp: legs=6, class_type=6, catsize=0X: legsZ height: catsizeY: class_type

Average catsize

0.5

Min catsize

0

Max catsize

1

X/Z corr.

0.201

Interpretation

This trisurface uses 32 valid animals. The height variable `catsize` ranges from 0to 1 with an average of 0.5. The surface does not change strongly with X and falls as Y increases. Class type is a label encoded as a number, so interpret it as animal group ordering for teaching rather than a true continuous measurement.

Python command for zoo_data.csv

In Python, the usual command is `ax.plot_trisurf(...)`. The important idea is to choose three numerical columns: one for X, one for Y, and one for the height Z.

# Draw a trisurface plot for 3D visualization on zoo_data.csv
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.tri import Triangulation

zoo_data = pd.read_csv("zoo_data.csv")

# Choose three numerical columns.
# Example: x = legs, y = class_type, z = catsize
x = zoo_data["legs"]
y = zoo_data["class_type"]
z = zoo_data["catsize"]

triangles = Triangulation(x, y)

fig = plt.figure(figsize=(10, 7))
ax = fig.add_subplot(111, projection="3d")
surface = ax.plot_trisurf(
    x,
    y,
    z,
    triangles=triangles.triangles,
    cmap="viridis",
    edgecolor="black",
    linewidth=0.4,
    alpha=0.9,
)

ax.set_xlabel("Legs")
ax.set_ylabel("Class Type")
ax.set_zlabel("Cat Size")
ax.set_title("TriSurface Plot of zoo_data.csv")
fig.colorbar(surface, shrink=0.6, aspect=12, label="Surface height")
plt.show()

How to interpret the graph

Each point represents one animal. The X and Y axes show two selected animal features, while the Z axis shows the height value. The triangular faces connect neighbouring points to form a surface.

High regions show larger Z values. Low regions show smaller Z values. If the surface rises as X or Y increases, that suggests a possible relationship between the selected variables.

In `zoo_data.csv`, many features are binary, such as hair, milk, predator, and aquatic. That means the surface can look stepped or blocky. This is normal for categorical/binary data, and it is a useful teaching moment: not every dataset produces a smooth surface.

A trisurface plot helps reveal shape and patterns, but it does not prove causation. Use it for exploration before modelling, then confirm patterns with statistics and machine learning validation.

What is happening step by step?

1. Load data

Read zoo_data.csv and detect numerical columns such as legs, predator, catsize, and class_type.

2. Choose X, Y, Z

Select two columns for the floor plane and one column as the surface height.

3. Build triangles

Neighbouring points are connected into triangular faces, which is why the plot is called trisurface.

4. Interpret shape

Look for high areas, low areas, sharp changes, clusters, and whether the surface is smooth or stepped.

Dataset preview

Showing the first 8 rows from Built-in zoo_data.csv sample

animal_namehairfeatherseggsmilkairborneaquaticpredatortoothedbackbonebreathesvenomousfinslegstaildomesticcatsizeclass_type
aardvark10010011110040011
antelope10010001110041011
bass00100111100101004
bear10010011110040011
boar10010011110041011
catfish00100111100101004
chicken01101000110021102
crow01101010110021002

Zoo data is useful for teaching because it mixes binary features, small integer counts, and class labels. This makes it clear that 3D visualisation is exploratory: it helps you notice structure before choosing features for machine learning.