How can I generate 3D plots in Mechanical?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 389
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How can I generate 3D plots in Mechanical ?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 389
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓

    By activating CPython in Mechanical and if you have tcl error, the following workaround should help: Tcl Error matplotlib

    3D chart examples

    A simple example:

    from mpl_toolkits import mplot3d
    import numpy as np
    import matplotlib.pyplot as plt
    
    my_fig = plt.figure()
    axes = plt.axes(projection='3d')
    z = np.linspace(0, 1, 100)
    x = z * np.sin(30 * z)
    y = z * np.cos(30 * z)
    
    axes.plot3D(x, y, z, 'maroon')
    axes.set_title('3D line plot')
    plt.show()