Individual Scalar Bars on each subplot #3203
-
Hey! I am using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Ahmed-Zeid So first the PyVista Theme was reset (right after pyvista is imported). import pyvista as pv
pv.set_plot_theme('default') Now in the MAPDL /POST1 processor I gather some results and the mesh at the last set of results on the result file. mapdl.set('last')
# add the node deformations to their positions to plot deformed shape
mapdl.upcoord(1)
mesh_1 = mapdl.mesh.grid
mesh_2 = mesh_1.copy()
mapdl.upcoord(-1)
# gather two results
result_1 = mapdl.post_processing.nodal_displacement("Y")
result_2 = mapdl.post_processing.nodal_component_stress("Y")
# put the results into the mesh objects
mesh_1["result1"] = result_1
mesh_2["result2"] = result_2
# set up for 2 plotting 'window' horizontal
plotter = pv.Plotter(shape=(2, 1), notebook=0)
# add first mesh/result
plotter.subplot(0, 0)
mesh_1.set_active_scalars("result1")
plotter.add_mesh(mesh_1, cmap='jet')
plotter.add_title('UY')
# add second mesh/result
plotter.subplot(1, 0)
mesh_2.set_active_scalars("result2")
plotter.add_mesh(mesh_2, cmap='jet')
plotter.add_title('SY')
# link the views so they pan/zoom/rotate together
plotter.link_views()
# show the plot
plotter.show(cpos='xy') I should have called the results better names than 'result1' and 'result2' as that gets added to the scalar legend. Oh well. |
Beta Was this translation helpful? Give feedback.
Hi @Ahmed-Zeid
Good timing - I've been working on this all day for an example. I think that there is something defined in the PyMAPDL "MAPDL Theme" used for PyVista (in PyMAPDL) that is at conflict with the 'normal' PyVista. I think. Anyway I managed to get this working. Here are the commands I used skipping over the FEM creation and solution.
So first the PyVista Theme was reset (right after pyvista is imported).
Now in the MAPDL /POST1 processor I gather some results and the mesh at the last set of results on the result file.