Numpy help needed (3 dimensional graphing with vectors and matrix)

    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import Axes3D

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    l = np.array([])
    x = int(input("Input starting x coordinate: "))
    y = int(input("Input starting y coordinate: "))
    z = int(input("Input starting z coordinate: "))
    l = np.array([x, y, z])

    x_data = (0, l[0] + 0.00001)
    y_data = (0, l[1] + 0.00001)
    z_data = (0, l[2] + 0.00001)

    print(x_data)
    print(y_data) #for debugging purposes
    print(z_data)

    ax.set_title("Matrix Rotation")
    ax.set_xlabel("x")
    ax.set_ylabel("y")
    ax.set_zlabel("z")

    ac = np.array([l[0], l[1], l[2]])

    ax.plot(x_data, y_data, z_data)
    plt.show()

    while True:
        angl = int(input("What angle would you like to rotate it by? "))
        answer = input("Would you like to rotate the line around the x, y, or z axis? (Enter 'x', 'y', or 'z') ")
        if answer.lower() == "x":
            matx = np.array([[1, 0, 0], [0, np.cos(np.degrees(angl)), -np.sin(np.degrees(angl))], [0, np.sin(np.degrees(angl)), np.cos(np.degrees(angl))]])
            newcoordinates = np.dot(ac, matx)
            print(newcoordinates)
        elif answer.lower() == "y":
            maty = np.array([[np.cos(np.degrees(angl)), 0, np.sin(np.degrees(angl))], [0, 1, 0], [-np.sin(np.degrees(angl)), 0, np.cos(np.degrees(angl))]])
            newcoordinates = np.dot(ac, maty)
        elif answer.lower() == "z":
            matz = np.array([[np.cos(np.degrees(angl)), -np.sin(np.degrees(angl)), 0], [np.sin(np.degrees(angl)), np.cos(np.degrees(angl)), 0], [0, 0, 1]])
            newcoordinates = np.dot(ac, matz)
            print(newcoordinates)
        else:
            print("Invalid input. Please enter 'x', 'y', or 'z'.")
            continue

        print("Out of if conditional")# also for debugging purposes

        x_data = np.array([0, newcoordinates[0] + 0.000001])
        y_data = np.array([0, newcoordinates[1] + 0.000001])
        z_data = np.array([0, newcoordinates[2] + 0.000001])

        ac = np.array([newcoordinates[0], newcoordinates[1], newcoordinates[2]])

        ax.clear()
        ax.set_title("Matrix Rotation")
        ax.set_xlabel("x")
        ax.set_ylabel("y")
        ax.set_zlabel("z")

        ax.plot(x_data, y_data, z_data)
        plt.draw()
        plt.pause(0.001)

   plt.show()

Hi and welcome to Discuss wxPython.

I don’t know why you are posting this code on this forum as it doesn’t use wxPython at all.

However, I notice that you call plt.show() just before the while loop. That call will block and run the GUI main loop until all figure windows are closed.

Try using plt.show(block=False) instead.