graphics - 在 Mathematica 中使用图形进行条件着色

标签 graphics wolfram-mathematica

请考虑:

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]

enter image description here

  • #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]

enter image description here

编辑

使用 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]

enter image description here

关于graphics - 在 Mathematica 中使用图形进行条件着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6577509/

相关文章:

java - 用图形 (java.awt.Graphics) 填充三个点 (java.awt.Point) 之间的区域

graphics - 成像问题: How to determine image quality?

c++ - VK_KHR_WIN32_SURFACE_EXTENSION_NAME 未定义,在 Vulkan 代码中

Python 前缀 后缀 中缀,无括号

wolfram-mathematica - GraphPlot/GraphPlot3D 中的虚线边

c# - 使用不安全的每像素访问绘制位图会导致空图像

c - 球近似程序中用户定义归一化函数的奥秘

matrix - 在 Mathematica 中构造大块矩阵的最有效方法是什么?

wolfram-mathematica - 在 Mathematica 中使用 $NewSymbol 移动上下文

Mathematica 中的结构数据类型?