Documentation·
pyvista/pyvista
Document updating a scalar bar by title in PyVista
Adds a docstring example for Plotter.update_scalar_bar_range that changes the range of a named scalar bar. The example shows mesh setup, scalar assignment, scalar-bar naming, and the update call.
The problem
The method documents a name parameter for selecting a scalar bar by title, but lacked an example in the shown docstring. Demonstrating that selection requires connecting the title supplied to add_mesh with the name passed to update_scalar_bar_range.
The approach
Create a sphere and assign its point z-coordinates to a scalar array named 'height'. Add the mesh with an initial range of (-0.5, 0.5) and a scalar bar titled 'Height', then update its range to (-1, 1) using name='Height' before displaying the plot. Include two documentation image-cache assets alongside the example.
What changed
The API docstring now contains a complete example of updating a scalar bar by its title; runtime implementation is unchanged.
- pyvista
- docstring
- scalar-bar
- plotting