请考虑:
dalist = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}, {4, 4, 4}, {5, 5, 5},
{1, 2, 1}, {2, 3, 1}, {3, 4, 1}, {4, 5, 1}, {5, 6, 1}}
我使用以下内容绘制上面的内容,其中 #2
和 #3
是 x 和 y 坐标
Graphics@MapThread[Point[{#2, #3}] &, Transpose@dalist]
#1
时间引用 I 想用它来着色 积分。在我的数据中它的范围是 1 到 30。
#1 =1
应该总是屈服于 相同的颜色。
编辑:建立以下解决方案
- 如何手动设置颜色范围/渐变或使用现有的(“BlackBodySpectrum”)?
最佳答案
尝试:
datlist = Flatten[Table[{i, j + i, j}, {i, 1, 20}, {j, 1, 20}], 1];
colordata = 60; (* Try different palettes 1 .. 62 *)
Graphics[(Sequence @@
{Directive[
ColorData[colordata][Mod[#[[1]], ColorData[colordata, "Range"][[2]]]]],
PointSize -> Large, Point[{#[[2]], #[[3]]}]} & /@ datlist),
Frame -> True]
编辑
使用 BlackBodySpectrum
:
datlist = Flatten[Table[{i, j + i, j}, {i, 1, 20}, {j, 1, 20}], 1];
colordata = "BlackBodySpectrum";(*Try different palettes 1.. 62*)
Graphics[(
Sequence @@ {Directive[
ColorData[
colordata][#[[1]] ColorData[colordata,
"Range"][[2]]/(Length@datlist/
Length@Select[datlist, #[[1]] == 1 &])]],
PointSize -> Large, Point[{#[[2]], #[[3]]}]} & /@ datlist),
Frame -> True]
关于graphics - 在 Mathematica 中使用图形进行条件着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6577509/