# Dynamically plotting all the edges of cuboid

I have a code which plots the edges and vertices of a cuboid.
However, I am unable to figure out how can I do the same inside FuncAnimation, using set_data and set_3d_properties.

Below is the code

``````import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt

v = np.array([[0, 0, 0], [0, 0, 1],
[0, 1, 0], [0, 1, 1],
[1, 0, 0], [1, 0, 1],
[1, 1, 0], [1, 1, 1]], dtype=int)

e = np.array([[0, 1], [0, 2], [0, 4],
[1, 3], [1, 5],
[2, 3], [2, 6],
[3, 7],
[4, 5], [4, 6],
[5, 7],
[6, 7]], dtype=int)

limits = np.array([[0, room_l], [0, room_b], [0, room_h]])

v = limits[np.arange(3)[np.newaxis, :].repeat(8, axis=0), v]

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(*v.T, marker='o', color='k', ls='')
for i, j in e:
ax.plot(*v[[i, j], :].T, color='r', ls='-')
``````

How to make this dynamic?
It is required to be made dynamic because my room_l, room_b, and room_h will change with time

You will need to capture the objects retruned by `ax.plot` and then update the data on those lines.

See
Animated line plot — Matplotlib 3.6.0 documentation and mpl_toolkits.mplot3d.art3d.Line3D — Matplotlib 3.6.0 documentation for `set_data_3d`.