Friday, December 1, 2023

Cop28

 Fine, we're bad!!

                                                                                    



                                                                                


                                 
                                                                            *     *     *

Hey, it's a work in progress. Getting familiar with styling in Matplotlib.

                                                              
                                                              

Still trying to figure out ax.view.init() which positions the camera when the code is run. 

Currently using settings from what looked no too bad last time I ran the code!!




import matplotlib.pyplot as plt
import numpy as np


# Define the vectors
vector = ([2, 3, 0])
vector1 = ([-4, 5, 0])

# Calculate the cross product
cross_product = np.cross(vector, vector1)

# Define the third vector
vector2 = ([0, 0, cross_product])

# Create a figure and axis object
fig, ax = plt.subplots(figsize=(10, 7), subplot_kw={'projection': '3d'})
fig.suptitle("The Vector Cross-Product", fontweight="bold", color='magenta', font='Arial', size='20')
# Set the face color of the figure
fig.set_facecolor((.8, .9, .9))


# Set the face color of the plot
ax.set_facecolor((.8, .9, .9))

# Set the aspect ratio of the
#ax.set_aspect( 'auto')

# Draw the vectors using quiver()
ax.quiver(0, 0, 0, vector[0], vector[1], vector[2], color='orange', linewidth=3)
ax.quiver(0, 0, 0, vector1[0], vector1[1], vector1[2], color='red', linewidth=3 )
ax.quiver(0, 0, 0, vector2[0], vector2[1], vector2[2], color='blue', linewidth=3)

# Set the x, y, and z limits of the plot
ax.set_xlim([-5, 5])
ax.set_ylim([-5, 5])
ax.set_zlim([-5, 25])

ax.set_xlabel('X', color='black', fontweight='bold', size=16)
ax.set_ylabel('Y', color='black', fontweight='bold', size=16)
ax.set_zlabel('Z', color='black', fontweight='bold', size=16)

#Elevation, azimuth and roll
ax.view_init(15,-72,0)
# Show the plot
plt.show()

No comments: