如何通过SciPy绘制3D曲线?

时间:2017-08-23 07:57:51

标签: python matplotlib scipy

我用代码

绘制2D曲线
c = 11
x = np.arange(0, 5, 0.1)
y = np.exp(c)/x
plt.plot(x,y)

如何在z轴为x,y时绘制一系列c曲线?第一行将更改为

c = np.arange(1, 70, 1)

如何沿x,y轴绘制70条z曲线?

1 个答案:

答案 0 :(得分:2)

你可以使用matplotlibs val monthWithIndex = Seq("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec").zipWithIndex.toMap val monthSim = udf( (mon : String) => { monthWithIndex( mon.substring( 0, 3)) }) val df = session.sparkContext.parallelize( Seq("Jan2016","Feb2016","Mar2016","Jun2016")).toDF("Month") df.withColumn("newMonth", monthSim($"Month")).orderBy("newMonth").drop("newMonth").show ,可以找到一个教程here

Axes3D

这给出了数字:

enter image description here