是否可以在 PowerPoint 中使用使用 Python 包 Plotly 创建的交互式图表?是否可以在幻灯片中插入绘图输出?
我有一个平面和一条正弦曲线。请问如何旋转这两个对象?我的意思是让平面在 -0.1 到 0.4 的区间内缓慢倾斜,以便例如在 0.4 点垂直于 z?经过较长时间的旋转,平面和正弦的最大值和最小值将构建“圆柱的表面,轴从点[0,-0.1,0]到点[0,0.4,0]”。我希望我的意思很清楚。
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
plane1 = -0.1
plane2 = 0.4
h = 0.03
# Plane
xp = np.array([[0, 0], [0, 0]])
yp = np.array([[plane1, plane2], [plane1, plane2]])
zp = np.array([[-h, -h], [h, h]])
ax.plot_surface(xp, yp, zp, alpha=0.4, color = 'red')
# Sine
f = 100
amp = h
y = np.linspace(plane1, plane2, 5000) …Run Code Online (Sandbox Code Playgroud) 我尝试过旋转,但不起作用。
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # 3d graph
from mpl_toolkits.mplot3d import proj3d # 3d graph
fig = plt.figure(figsize=[5,6])
ax = fig.gca(projection='3d')
ax.text(0, 0, 8.8, '$z$', 'z')
plt.show()
Run Code Online (Sandbox Code Playgroud)
这个警告是什么意思?我怎样才能摆脱这个?
Support for setting the 'text.latex.preamble' or 'pgf.preamble' rcParam to a list of strings is deprecated since 3.3 and will be removed two minor releases later; set it to a single string instead.
plt.rcParams['text.latex.preamble'] = [r"\usepackage{bm}", [r"\usepackage{amsmath}"]
Run Code Online (Sandbox Code Playgroud)
代码:
import matplotlib.pyplot as plt
plt.rcParams['text.latex.preamble'] = [r"\usepackage{bm}"], [r"\usepackage{amsmath}"]
params = {'text.usetex' : True,
'font.size' : 28,
'font.family' : 'lmodern',
}
plt.rcParams.update(params)
Run Code Online (Sandbox Code Playgroud) 我有几个点和一条曲线,描述为两个列表(包括位置)。我尝试获取点和曲线之间的差异列表。我试图关注这个网络,但我不明白这个命令:
X = fmin_cobyla(objective, x0=[0.5,0.5], cons=[c1])
Run Code Online (Sandbox Code Playgroud)
请问我的案例中正确的论据是什么?
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import fmin_cobyla
data = np.loadtxt('O_Cout.dat', unpack=True, usecols=[0, 2])
z_1v1 = np.polyfit(data[0], data[1], 2)
f_1v1 = np.poly1d(z_1v1)
# Creating more points on the streamline - defining new time with more steps
x_new = list(np.arange(0,100000,1))
y_new = f_1v1(x_new)
# Plot figure with size
fig, ax = plt.subplots()
ax.scatter(data[0], data[1])
ax.plot(x_new, y_new)
def objective(X):
x,y = X
return np.sqrt((x - P[0])**2 + …Run Code Online (Sandbox Code Playgroud)