-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plot_Surface_plates2.py
35 lines (31 loc) · 2.33 KB
/
Plot_Surface_plates2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
# as plot_surface needs 2D arrays as input
# x = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
# y = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
# 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9]
x = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800, 810, 820, 830, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 960, 970, 980, 990, 1000]
y = [400, 1600, 3600, 6400, 10000, 14400, 19600, 25600, 32400, 40000, 48400, 57600, 67600, 78400, 90000, 102400, 115600, 129600, 144400, 160000, 176400, 193600, 211600, 230400, 250000, 270400, 291600, 313600, 336400, 360000, 384400, 409600, 435600, 462400, 490000, 518400, 547600, 577600, 608400, 640000, 672400, 705600, 739600, 774400, 810000, 846400, 883600, 921600, 960400, 1000000, 1040400, 1081600, 1123600, 1166400, 1210000, 1254400, 1299600, 1345600, 1392400, 1440000, 1488400, 1537600, 1587600, 1638400, 1690000, 1742400, 1795600, 1849600, 1904400, 1960000, 2016400, 2073600, 2131600, 2190400, 2250000, 2310400, 2371600, 2433600, 2496400, 2560000, 2624400, 2689600, 2755600, 2822400, 2890000, 2958400, 3027600, 3097600, 3168400, 3240000, 3312400, 3385600, 3459600, 3534400, 3610000, 3686400, 3763600, 3841600, 3920400, 4000000]
# we make a meshgrid from the x,y data
X, Y = np.meshgrid(x, y)
Z = np.zeros(shape = (len(y), len(x)))
for i, a in enumerate(y):
for j, b in enumerate(x):
# if a <= 0.1:
# Z[i][j] = a * a
# elif a > 0.1 and a <= 0.3:
# Z[i][j] = Z[i-1][j-1]**2
# elif a > 0.3 and a <= 0.5:
# Z[i][j] = Z[i-1][j-1]*2 - 1
# elif a > 0.5 and a <= 0.7:
# Z[i][j] = Z[i-1][j-1]**2 + 1
# elif a > 0.7:
Z[i][j] = i * i**4
# plot_surface with points X,Y,Z and data_value as colors
surf = ax.plot_surface(X, Y, Z, cmap='Greys', antialiased=True)
plt.show()