标题:如何绘制云图
只看楼主
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:934
专家分:5244
注 册:2015-8-10
结帖率:100%
 问题点数:0 回复次数:5 
如何绘制云图
RT。想实现类似于应力云图的效果,以一个四节点的单元为例简单的说,知道四个节点的应力数值,在整个单元范围之内根据已知四个点的应力数值绘制出云图效果。
类似下面的图
搜索更多相关主题的帖子: 效果 绘制 数值 节点 单元 
2020-12-26 16:17
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:934
专家分:5244
注 册:2015-8-10
得分:0 
没人写过或者看过类似的代码么?
简单的说就是:已知一个形状边界点上的颜色(其实就是颜色),在形状中建立一个多点之间的渐变填充模式,对其进行填充
2020-12-28 15:16
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:934
专家分:5244
注 册:2015-8-10
得分:0 
终于找到一个比较接近的例子,然后自己修改了一个。
程序代码:
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt

# 4 Point Sample Data
#x=np.array([7.071067812,10,7.071067812,1.22515E-15])
#y=np.array([7.071067812,6.12574E-16,-7.071067812,-10])
#z=np.array([0.322,0.337,0.379,0.344])

# 8 Point Sample Data
# x=np.array([7.071067812,10,7.071067812,1.22515E-15,-7.071067812,-10,-7.071067812,-2.4503E-15])
# y=np.array([7.071067812,6.12574E-16,-7.071067812,-10,-7.071067812,-1.83772E-15,7.071067812,10])
# z=np.array([0.322,0.337,0.379,0.344,0.328,0.331,0.435,0.386])

# 12 Point Sample Data
x = np.array([5,8.660254038,10,8.660254038,5,1.22515E-15,-5,-8.660254038,-10,-8.660254038,-5,-2.4503E-15])
y = np.array([8.660254038,5,6.12574E-16,-5,-8.660254038,-10,-8.660254038,-5,-1.83772E-15,5,8.660254038,10])
z = np.array([0.006,0.021,0.063,0.028,0.012,0.015,0.119,0.07,0.071,0,0.003,0.054])


def plot_contour(x,y,z,resolution = 50,contour_method='linear'):
    resolution = str(resolution)+'j'
    X,Y = np.mgrid[min(x):max(x):complex(resolution),   min(y):max(y):complex(resolution)]
    points = [[a,b] for a,b in zip(x,y)]
    Z = griddata(points, z, (X, Y), method=contour_method)
    return X,Y,Z


X,Y,Z = plot_contour(x,y,z,resolution = 500,contour_method='cubic')

with plt.style.context("seaborn-white"):
    fig, ax = plt.subplots(figsize=(13,13))
    ax.scatter(x,y, color="Red", linewidth=1, edgecolor="ivory", s=50)
    ax.contourf(X, Y, Z, cmap="rainbow")
    fig.show()
2020-12-29 09:36
sssooosss
Rank: 9Rank: 9Rank: 9
等 级:禁止访问
威 望:3
帖 子:664
专家分:1115
注 册:2019-8-27
得分:0 
新年快乐
2020-12-31 08:54
YOLO_enjoy
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2020-11-7
得分:0 
回复 4楼 sssooosss
快乐
2021-01-03 16:47
西岭河
Rank: 2
等 级:论坛游民
帖 子:44
专家分:10
注 册:2021-3-9
得分:0 
找高手用python开发个选股软件
能够通过聚宽量化交易网的api来获取历史数据,
可以自定义选股策略,
后台有可视化历史数据回测,以折线图形式比对实际走势与策略走势
有意者连Q845612081

2021-03-12 10:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-504398-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.523315 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved