如何使用Plotly绘制n度曲线

时间:2018-09-07 14:22:15

标签: python plotly

A有一个条件:(x_1)^ n + 4 *(x_2)^ n <=4。我想像在3D中设置的预算一样绘制它。 我知道如何在n = 2时做到这一点:

precise = 40
r = np.linspace(0,1,precise)                  # radius
phi = np.linspace(0, 2*np.pi, precise)        # angle

r, phi = np.meshgrid(r, phi)              # computational grid

x1 = 2 * r * np.cos(phi)                         # parametrization
x2 = r * np.sin(phi)
z = np.zeros((precise,precise))

budget_set = go.Surface(x=x1, y=x2, z=z, opacity = 0.9)

data = [budget_set]

layout = go.Layout(##some code about layout##)

fig = go.Figure(data=data, layout=layout)
plotly.offline.iplot(fig)

它以3D形式绘制椭圆。

但是当n = 3,4,...时我该如何处理呢?

0 个答案:

没有答案