Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- from mpl_toolkits import mplot3d
- from matplotlib.ticker import LinearLocator, FormatStrFormatter
- def f(x, y):
- return (x**3+x**2+y**2++2*x*y+-10*x+2*y)
- x = np.linspace(-6, 6, 20)
- y = np.linspace(-6, 6, 20)
- X, Y = np.meshgrid(x, y)
- Z = f(X, Y)
- fig = plt.figure()
- ax = plt.axes(projection='3d')
- ax.set_title('Grafiko pavadinimas');
- ax.set_xlabel('x asis')
- ax.set_ylabel('y asis')
- ax.set_zlabel('z asis');
- ax.view_init(10, 70)
- plotas = ax.plot_surface(X, Y, Z, cmap="magma")
- fig.colorbar(plotas, shrink=0.5, aspect=20) #color bar properties
- ticks = np.linspace(-6,6,26)
- ticks2=np.linspace(-150, 300, 26)
- ax.set_yticks(ticks)
- ax.set_xticks(ticks)
- ax.set_zticks(ticks2)
- xlabels=[""]*26
- xlabels[25]=10
- xlabels[12]=0
- xlabels[0]=-10
- ylabels=[""]*26
- ylabels[25]=10
- ylabels[12]=0
- ylabels[0]=-10
- zlabels=[""]*26
- zlabels[0]=-100
- zlabels[6]=-50
- zlabels[25]=250
- zlabels[12]=0
- zlabels[18]=100
- ax.set_zticklabels(zlabels)
- ax.set_xticklabels(xlabels)
- ax.set_yticklabels(ylabels)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement