我有一个由三个变量 u、v、w 组成的模型,它们随时间和空间而变化。我对这三个变量的比率特别感兴趣。但我宁愿只使用一张图,而不是显示三张图,每张图对应一个变量。
我的想法是使用麦克斯韦三角形(彩色三角形,请参阅http://homepages.abdn.ac.uk/npmuseum/article/Maxwell/MaxTri.html)。我可以轻松地缩放每个变量,使其最大值为 1。但我不知道这个想法是否可以实现。如果有意义的话,它应该已经存在。我的问题:
我尝试举一个简短的例子以使其更容易理解:
import numpy as np
import matplotlib.pyplot as plt
# create three arrays for the state variables
# space is a 200x200 grid
size = 200
u = np.random.rand(size,size)
v = np.random.rand(size,size)
w = np.random.rand(size,size)
# now I could create 3 subplots and plot the spatial distribution
# for each variable
# but I want something like
col = np.zeros((200,200))
for i in range(200): # loop in x-direction
for j in …Run Code Online (Sandbox Code Playgroud) 我想创建一个麦克斯韦颜色三角形
(https://homepages.abdn.ac.uk/npmuseum/article/Maxwell/Legacy/MaxTri.html)
使用 Matplotlib。我找到了类似的代码:http://www.f-legrand.fr/scidoc/docmml/image/niveaux/couleurs/couleurs.html
然而,在这种情况下,等比例的 R、G 和 B 会产生较暗的颜色,这不是我想要的。
欢迎任何想法。我真的很挣扎。