Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from mpl_toolkits.mplot3d import Axes3D
- # Create the figure and a 3D axis
- fig = plt.figure()
- ax = fig.add_subplot(111, projection='3d')
- # Define points at different levels of the cone
- base = [0, 0, 0] # Base axiom
- level_1 = [[1, 0, 1], [-1, 0, 1]] # First set of derived statements
- level_2 = [[2, 1, 2], [-2, 1, 2], [1.5, -1, 2], [-1.5, -1, 2]] # Next derivations
- # Function to generate points in a circular (conical) pattern
- def generate_cone_points(level, num_points, radius):
- # Z-coordinate is fixed to the level number (height)
- z = level
- points = []
- # Angle between points (in radians) to distribute them evenly in a circle
- angle_increment = 2 * np.pi / num_points
- for i in range(num_points):
- angle = i * angle_increment
- x = radius * np.cos(angle)
- y = radius * np.sin(angle)
- points.append([x, y, z])
- return points
- # Generate points for level 3 and onward with conical spread
- level_3 = generate_cone_points(3, 6, 3) # 6 points at level 3 with radius 3
- level_4 = generate_cone_points(4, 8, 4) # 8 points at level 4 with radius 4
- level_5= generate_cone_points(5, 10, 5) # 10 points at level 5 with radius 5
- # Plot the base
- ax.scatter(base[0], base[1], base[2], c='red', s=100, label='Axiom')
- # Plot level 1 points
- for point in level_1:
- ax.scatter(point[0], point[1], point[2], c='blue', s=60)
- ax.plot([base[0], point[0]], [base[1], point[1]], [base[2], point[2]], color='black')
- # Plot level 2 points
- for point in level_2:
- ax.scatter(point[0], point[1], point[2], c='green', s=60)
- for l1_point in level_1:
- ax.plot([l1_point[0], point[0]], [l1_point[1], point[1]], [l1_point[2], point[2]], color='black')
- # Plot level 3 points (cone pattern)
- for point in level_3:
- ax.scatter(point[0], point[1], point[2], c='orange', s=60)
- for l2_point in level_2:
- ax.plot([l2_point[0], point[0]], [l2_point[1], point[1]], [l2_point[2], point[2]], color='black')
- # Plot level 4 points (cone pattern)
- for point in level_4:
- ax.scatter(point[0], point[1], point[2], c='purple', s=60)
- for l3_point in level_3:
- ax.plot([l3_point[0], point[0]], [l3_point[1], point[1]], [l3_point[2], point[2]], color='black')
- # Plot level 5 points (cone pattern)
- for point in level_5:
- ax.scatter(point[0], point[1], point[2], c='yellow', s=60)
- for l4_point in level_4:
- ax.plot([l4_point[0], point[0]], [l4_point[1], point[1]], [l4_point[2], point[2]], color='black')
- # Labels and legend
- ax.set_title('Entailment Cone')
- ax.set_xlabel('X Axis')
- ax.set_ylabel('Y Axis')
- ax.set_zlabel('Z Axis')
- plt.legend()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement