小编Aim*_*Aim的帖子

如何在Matplotlib中绘制单条轮廓线

以下代码是从这里借用的:

import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt


delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2

fig, ax = plt.subplots()
CS = ax.contour(X, Y, Z)
ax.clabel(CS, inline=True, fontsize=10)
ax.set_title('Simplest default with labels')
Run Code Online (Sandbox Code Playgroud)

上面的代码生成带有 7 条等高线的等高线图。如何绘制一条带有值的等高线0.5

上述代码的输出是:

在此输入图像描述

python matplotlib

5
推荐指数
1
解决办法
8015
查看次数

SIMD和多线程的区别

在并行编程范式中遇到的 SIMD 和多线程概念之间有什么区别?

parallel-processing multithreading simd

3
推荐指数
1
解决办法
878
查看次数

Create a 3D surface plot in Plotly

I want to create a 3D surface plot in Plotly by reading the data from an external file. Following is the code I am using:

    import numpy as np
    import plotly.graph_objects as go 
    import plotly.express as px
    
    
    data = np.genfromtxt('values.dat', dtype=float)
    
    # The shape of X, Y and Z is (10,1)
    X = data[:,0:1] 
    Y = data[:,1:2]
    Z = data[:,2:3]
    
    fig = go.Surface(x=X, y=Y, z=Z, name='Surface plot', colorscale=px.colors.sequential.Plotly3)
    plot(fig)
Run Code Online (Sandbox Code Playgroud)

The above code does not produce any surface plot. What changes …

python plot plotly

3
推荐指数
1
解决办法
9988
查看次数