1919# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121# SOFTWARE.
22+ """
23+ .. _ref_plain_usage_plotly:
24+
25+ =================================
26+ Plain usage of the plotly backend
27+ =================================
28+
29+ This example shows the plain usage of the Plotly backend in the Visualization Interface Tool to plot different objects,
30+ including PyVista meshes, custom objects, and Plotly-specific objects.
31+ """
2232
2333from ansys .tools .visualization_interface .backends .plotly .plotly_interface import PlotlyBackend
2434from ansys .tools .visualization_interface .types import MeshObjectPlot
2535from ansys .tools .visualization_interface import Plotter
2636import pyvista as pv
2737from plotly .graph_objects import Mesh3d
2838
39+
2940# Create a plotter with the Plotly backend
3041pl = Plotter (backend = PlotlyBackend ())
3142
3546# Plot the mesh
3647pl .plot (mesh )
3748
49+ #####################
3850# Display the plotter
39- pl .show ()
51+ #
52+ # code-block:: python
53+ #
54+ # pl.show()
4055
4156# Now create a custom object
4257class CustomObject :
@@ -62,8 +77,14 @@ def name(self):
6277# Plot the custom mesh object
6378pl .plot (mesh_object_cube )
6479
65- # Since Plotly is a web-based visualization, we can show the plot again to include the new object
66- pl .show ()
80+ ###########################
81+ # Display the plotter again
82+ # =========================
83+ # Since Plotly is a web-based visualization, we can show the plot again to include the new object.
84+ #
85+ # code-block:: python
86+ #
87+ # pl.show()
6788
6889# Add a Plotly Mesh3d object directly
6990custom_mesh3d = Mesh3d (
@@ -77,7 +98,6 @@ def name(self):
7798 opacity = 0.50
7899)
79100pl .plot (custom_mesh3d )
80- pl .show ()
81101
82102# Show other plotly objects like Scatter3d
83103from plotly .graph_objects import Scatter3d
@@ -90,4 +110,11 @@ def name(self):
90110 marker = dict (size = 5 , color = 'red' )
91111)
92112pl .plot (scatter )
93- pl .show ()
113+
114+ ###########################
115+ # Display the plotter again
116+ # =========================
117+ #
118+ # code-block:: python
119+ #
120+ # pl.show()
0 commit comments