| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 308 人关注过本帖
标题:如何绘制云图
只看楼主 加入收藏
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:920
专家分:5237
注 册:2015-8-10
结帖率:100%
收藏
 问题点数:0 回复次数:4 
如何绘制云图
RT。想实现类似于应力云图的效果,以一个四节点的单元为例简单的说,知道四个节点的应力数值,在整个单元范围之内根据已知四个点的应力数值绘制出云图效果。
类似下面的图
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 效果 绘制 数值 节点 单元 
2020-12-26 16:17
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:920
专家分:5237
注 册:2015-8-10
收藏
得分:0 
没人写过或者看过类似的代码么?
简单的说就是:已知一个形状边界点上的颜色(其实就是颜色),在形状中建立一个多点之间的渐变填充模式,对其进行填充
2020-12-28 15:16
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:920
专家分:5237
注 册: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: 7Rank: 7Rank: 7
等 级:黑侠
威 望:3
帖 子:184
专家分:510
注 册:2019-8-27
收藏
得分:0 
新年快乐
2020-12-31 08:54
YOLO_enjoy
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2020-11-7
收藏
得分:0 
回复 4楼 sssooosss
快乐
2021-01-03 16:47
快速回复:如何绘制云图
数据加载中...
 
   



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

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