Diagramm 3D -Diagramm mit PythonPython

Python-Programme
Anonymous
 Diagramm 3D -Diagramm mit Python

Post by Anonymous »

Ich versuche, ein Diagramm einer Funktion f (x, y) = x ** x*y zu zeichnen, aber ich erhalte einen Fehler:

Code: Select all

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

def f(x,y):
return x**x*y

x = np.arange(-4.0, 4.0, 0.1)
y = np.arange(-4.0, 4.0, 0.1)
z = f(x, y)
X, Y, Z = np.meshgrid(x, y, z)

fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(X, Y, Z)
plt.xlabel('x')
plt.ylabel('y')
plt.show()
Erster Fehler ist:

/usr/local/lib/python3.7/dist-packages/ipykernel_launchner IS: < /p>

valueError: Argument Z muss 2-dimensional sein. < /p>
< /blockquote>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post