Open
Description
Bug report
Bug summary
Discovered whilst investigating #17130, the get_datalim
method of Line3DCollection
is returning inf
values for a finite 3D line collection.
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Line3DCollection
segments = [[(0, 0), (1, 1)]]
collection = LineCollection(segments)
fig, ax = plt.subplots()
ax.add_collection(collection)
print('2D:', collection.get_datalim(ax.transAxes))
segments = [[(0, 0, 0), (1, 1, 1)]]
collection = Line3DCollection(segments)
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.add_collection3d(collection)
print('3D:', collection.get_datalim(ax.transAxes))
Actual outcome
2D: Bbox(x0=0.0, y0=0.0, x1=1.0, y1=1.0000000000000002)
3D: Bbox(x0=inf, y0=inf, x1=-inf, y1=-inf)
Expected outcome
The 3D case to have finite and [0, 1] bounds for x and y. Possibly it should also return the z bounds too.