I found while visualizing a dataset that subplots sometimes fail to show bounds/axis titles under the conditions I'm plotting in. Minimal reproducible code is:
import pyvista as pv
mesh = pv.ParametricRandomHills(number_of_hills=13, hill_amplitude=7)
mesh_edges = mesh.extract_all_edges()
camera_positions = ['xy', 'xz', 'yz', 'yx', 'zx', 'zy', 'iso']
pl = pv.Plotter(shape=(1,len(camera_positions)), window_size=(500*len(camera_positions),500))
for i, pos in enumerate(camera_positions):
pl.subplot(0,i)
pl.add_mesh(mesh_edges)
pl.show_bounds()
pl.camera_position = pos
pl.show()
Both axis titles should show by default. In the 'xz', 'yx', and 'zy' camera positions, this seems to break down. This appears to be the case regardless of the aspect ratio of the dataset and the size of the subplots/plotter. Why is this, and is it fixable without changing something in the underlying PyVista or VTK libraries (barring screwing with manual labeled points)?
The axis labels do appear after interacting with the plots and changing the camera position somewhat.
My conda environment is in Python 3.13.7, and I'm on a system with an Apple M1 and macOS 15.2. PyVista version is 0.46.3.
Thanks for the great example!
This looks like this PyVista issue. If you look very hard the missing axis label is there in the second subplot, but it's very small and distorted. This comment on the issue suggests that this is a VTK issue that is resolved in VTK 9.5.
And indeed: I could reproduce your issue with VTK 9.3.1, and the issue was fixed when I upgraded my env to VTK 9.5.2. I suggest upgrading your VTK version to see if it fixes the problem.