gpt-3.5-turbo-0301· openai
Suzhen/CodeChat
hi
- User
hi
- Assistant
Hello! How can I assist you today?
- User
write me a python code that generates a 3d cube
- Assistant
Sure, here is a Python code that uses the "matplotlib" library to generate a 3D cube:
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.art3d import Poly3DCollection fig = plt.figure() ax = fig.add_subplot(111, projection='3d') X = [0, 1, 1, 0, 0, 1, 1, 0] Y = [0, 0, 1, 1, 0, 0, 1, 1] Z = [0, 0, 0, 0, 1, 1, 1, 1] cube = [(X[0:4], Y[0:4], Z[0:4]), (X[4:8], Y[4:8], Z[4:8]), (X[0:2]+[X[5]]+[X[4]], Y[0:2]+[Y[5]]+[Y[4]], Z[0:2]+[Z[5]]+[Z[4]]), (X[1:3]+[X[6]]+[X[5]], Y[1:3]+[Y[6]]+[Y[5]], Z[1:3]+[Z[6]]+[Z[5]]), (X[3:4]+[X[7]]+[X[6]], Y[3:4]+[Y[7]]+[Y[6]], Z[3:4]+[Z[7]]+[Z[6]])] colors = ['red', 'green', 'blue', 'yellow', 'orange', 'purple'] faces = Poly3DCollection(cube) faces.set_facecolor(colors) ax.add_collection3d(faces) ax.set_xlim([0, 1]) ax.set_ylim([0, 1]) ax.set_zlim([0, 1]) plt.show()This code will create a 3D figure of a cube using the given coordinates (X, Y, Z) and different colors for each side. You can modify the colors, coordinates, and add more vertices for other shapes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- gpt-3.5-turbo-0301Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →