Skip to content

Commit a8bc8d1

Browse files
authored
Fixed double colorbar in example. (#672)
* Fixed double colorbar in example. * Fixing style. * Added title to colorbar. * Removed useless output in pl.show.
1 parent ad45658 commit a8bc8d1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/00-mapdl-examples/path_operations.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,13 @@
177177

178178
# good camera position (determined manually using pl.camera_position)
179179
cpos = [(3.2, 4, 8), (0.25, 1.0, 5.0), (0.0, 0.0, 1.0)]
180+
max_ = np.max((out["Stress YZ"].max(), stress_slice['Stress YZ'].max()))
181+
min_ = np.min((out["Stress YZ"].min(), stress_slice['Stress YZ'].min()))
182+
clim = [min_, max_]
180183

181-
rng = [rst.grid["Stress YZ"].min(), rst.grid["Stress YZ"].max()]
182184
pl = pv.Plotter()
183-
pl.add_mesh(out, scalars=out["Stress YZ"], line_width=10)
184-
pl.add_mesh(stress_slice, scalars="Stress YZ", opacity=0.25)
185-
pl.add_mesh(rst.grid, color="w", style="wireframe")
185+
pl.add_mesh(out, scalars=out["Stress YZ"], line_width=10, clim=clim, scalar_bar_args={'title': 'Stress YZ'})
186+
pl.add_mesh(stress_slice, scalars="Stress YZ", opacity=0.25, clim=clim, show_scalar_bar=False)
187+
pl.add_mesh(rst.grid, color="w", style="wireframe", show_scalar_bar=False)
186188
pl.camera_position = cpos
187-
pl.show()
189+
_ = pl.show()

0 commit comments

Comments
 (0)