- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 MatplotLib 创建一个瓶子作为革命固体。我有这几点:
Image of the coordinates
在坐标方面是:
coords = [(0.00823433249299356, 0.06230346394288128),
(0.04086905251958573, 0.0648935210878489),
(0.08386400112604843, 0.0648935210878489),
(0.11753474401062763, 0.06541153251684242),
(0.14239929260231693, 0.05712334965294601),
(0.19109236692770842, 0.05401528107898486),
(0.2278711783862488, 0.05142522393401722),
(0.24133947554008045, 0.04158300678314021)]
多项式(或多或少准确)是:
Lambda(x, -19493.7965633925*x**6 + 13024.3747084876*x**5 - 3228.16456296349*x**4 + 368.816080918066*x**3 - 20.500262217588*x**2 + 0.545840273670868*x + 0.0590464366057008)
我得到的:
# Getting the polynomial:
z = np.polyfit(xdata, ydata, 6)
# Being xdata and ydata the 2 vector from the coordinates
x = sp.symbols('x', real=True)
P = sp.Lambda(x,sum((a*x**i for i,a in enumerate(z[::-1]))))
print(P)
该点描述了瓶子的轮廓(发挥你的想象力)是 XY 平面上的瓶子。
# Create the polynomial
pol = sp.lambdify(x,P(x),"numpy")
# Create the matrix of points
X = np.linspace(xdata[0], xdata[-1], 50)
Y = pol(X)
X, Y = np.meshgrid(X, Y)
# As long as a bottle is no more than a big amount of small cylinders, my
# equation should be more or less like:
# Z = x**2 + y** -R**2
# So we create here the equation
Z = X**2 + Y**2 - (Y - 0.0115)**2
# We create the #D figure
fig = plt.figure()
ax = plt.axes(projection="3d")
# And we representate it
surf = ax.plot_surface(X, Y, Z)
# We change the labels
ax.set_xlabel('$x$')
ax.set_ylabel('$y$')
ax.set_zlabel('$z$')
# And show the figure
plt.show()
问题是我得到的不再是一瓶(我认为是因为我如何使用
plot_surface
(我不太了解如何通过阅读文档来使用它)。
最佳答案
我将 unutbu's answer 引用到一个类似的问题。
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as axes3d
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')
# grab more points between your coordinates, say 100 points
u = np.linspace(0.00823433249299356, 0.24133947554008045, 100)
def polynomial(x):
return -19493.7965633925*x**6 + 13024.3747084876*x**5 - 3228.16456296349*x**4 + 368.816080918066*x**3 - 20.500262217588*x**2 + 0.545840273670868*x + 0.0590464366057008
v = np.linspace(0, 2*np.pi, 60)
U, V = np.meshgrid(u, v)
X = U
Y1 = polynomial(X)*np.cos(V)
Z1 = polynomial(X)*np.sin(V)
# Revolving around the axis
Y2 = 0*np.cos(V)
Z2 = 0*np.sin(V)
ax.plot_surface(X, Y1, Z1, alpha=0.3, color='red', rstride=6, cstride=12)
ax.plot_surface(X, Y2, Z2, alpha=0.3, color='blue', rstride=6, cstride=12)
# set the limits of the axes
ax.set_xlim3d(-0.3, 0.3)
ax.set_ylim3d(-0.3, 0.3)
ax.set_zlim3d(-0.3, 0.3)
plt.show()
关于python - 使用 MatplotLib Python 实现革命,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61138048/
我有一个网站,在使用桌面浏览时可以与转速 slider 完美配合。但是,当从移动设备浏览时, slider 图像无法正确显示或被切断。有没有办法在移动浏览器访问网站时切换 slider 内的图像或者我
我有一个简单的页面(没有 cms),其中安装了旋转 slider 。这是 demo 真正奇怪的是,在某些浏览器中,箭头(向前和向后)显示正确,而在其他浏览器中,有中文(或其他)字符而不是箭头。例如,在
我正在我的网站上使用 jQuery Revolution slider 。我想在点击停止和开始 slider >。我该怎么做。 $('.rev-slider-banner-full').revolut
我在 chrome 中遇到自动播放问题。 http://grouptelcom.com/ 我在需要自动播放的选项上写了所有参数,但如果我第一次访问站点,自动播放不起作用。 Chro
我正在使用 themeco 的 X 主题和 Revolution slider 我想让菜单栏透明, slider 在它后面,这样 slider 的顶部就是菜单栏的背景。如果我将菜单栏设为透明,它只会在
我有很多子页面,我在主页上显示了最新的 3 个,我只能显示标题但不能显示图像(每个子页面都有名为“image_prew”的电视,我正在尝试获取此电视的值(value)图片),这是我的代码:
我有一个带有 Revolution Slider 的 WP 网站,它在主页上自动播放全屏 YouTube 视频。 我在设置中为视频选择了静音选项,但音频在加载时播放 1 秒!从字面上看,这听起来像是一
我正在尝试让 Slider Revolution slider 在 BarbaJS 中重新初始化。 我目前正在设置最初由 ThemePunch 文档标注的函数: // RevSlider functi
我在 Wordpress CMS 上安装了 Revolution Slider。我在 Revolution Slider 面板中实现了自定义 CSS。当你第一次加载页面时, slider 在左上角和右
我们有一个网站:http://kentinflatables.co.uk/ 我们在主页上使用旋转 slider 。有 3 张幻灯片,但只有第一张显示背景图片,另外 2 张幻灯片没有。 我是新来的,请帮
我正在尝试在 Revolution slider 中设置两种类型的幻灯片。将有幻灯片的主要背景图像,然后是占幻灯片左侧或右侧 40% 的半透明层,上面是文本层。我有以下 css 可以使用“after”
我正在开发 www.fundacionbiodiversa.org 的网站,它带有一个 4.5.6 版的革命 slider (该主题的最新版本)。 除了 Firefox,它在所有设备上都能完美运行,它
有没有办法在没有 wordpress 的情况下在网站上使用 wordpress Revolution Slider(这意味着只有 HTML 和 CSS 网站)?我试图寻找一些 JS,但有太多的 JS
我需要安装 Revolution R在 Debian Jessie(版本 8,64 位)上。 在我的系统上已经安装了R 3.1.1和 Rstudio . Revolution download pag
我正在尝试使用 in 过滤一个非常大的 xdf 文件(位于 cloudera 上)以将其与另一个 xdf 文件(位于 cloudera 上)进行比较。 如果我尝试: rxDataStep(inData
我在项目中使用了wrappbootstrap 的主题,但 slider 上的值不是数字,这会导致网站速度出现一些小性能问题。 这里是主题的链接: http://themes.iamabdus.com/
我想在此 html 中定位图像,以便我可以针对移动设备调整它,因为我在使用此 slider 时遇到问题。 代码如下:
我继承了这个网站:http://www.thinkiam.com/ 它是使用 Slider Revolution 的 WordPress。 slider 及其图像的默认全尺寸为 1200p。当屏幕小于
JQMIGRATE:已安装 Migrate,版本 1.4.1 revolution.extension.actions.min.js?ver=5.3.1.5:7 Uncaught TypeEr
我是一名优秀的程序员,十分优秀!