Updated per your comment:
import matplotlib.pyplot as plt
# Define the first_derivative and iterations data
first_derivative = [1 + 1j, 2 + 2j, 3 + 3j, 4 + 4j, 5 + 5j]
iterations = [0, 1, 2, 3, 4]
# Split the first_derivative into real and imaginary parts
x = [val.real for val in first_derivative]
y = [val.imag for val in first_derivative]
# Create a figure and axis for the 3D plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Plot the data as a scatter plot
ax.scatter(x, y, iterations, c='r', marker='o')
# Set the x, y, and z labels
ax.set_xlabel('Real Part')
ax.set_ylabel('Imaginary Part')
ax.set_zlabel('Number of Iterations')
# Show the plot
plt.show()

Old Code
Using the matplotlib
library:
import matplotlib.pyplot as plt
# Example values of first derivative and the number of iterations
first_derivative = [1 + 1j, 2 + 2j, 3 + 3j, 4 + 4j, 5 + 5j]
iterations = [0, 1, 2, 3, 4]
# Plot the values of first derivative vs number of iterations
plt.plot(iterations, first_derivative, 'ro')
plt.xlabel('Number of iterations')
plt.ylabel('First derivative')
plt.title('First derivative vs Number of iterations')
plt.show()
the ro
argument passed to the plot function is a format string that specifies the format of the data points to be plotted. The format string consists of two characters:
r
: specifies the color of the data points as red
.
o
: specifies the shape of the data points as circles
.
You can use different format strings to specify different colors and shapes for the data points. For example, bx
would specify blue crosses
, g^
would specify green triangles
, and so on.
