如何将 7 个不连续的结果值划分为 5 个图例类别?

数据挖掘 可视化
2022-03-03 21:02:23

我正在制作一张地图,显示河流河段的得分结果。分数结果是从 1 到 7的整数。

现在我想为我的结果制作一个图例和颜色代码。但是,我不想使用太多的色调,因为人眼/大脑并不能真正区分超过 +/- 5 种色调。

所以我的问题是:我如何将我的 7 个(非连续)分数结果分成 5 个类别用于我的图例?

我想到了以下选项:

传说1:

  • 结果 = 1 - 2
  • 结果 = 3
  • 结果 = 4
  • 结果 = 5
  • 结果 = 6 - 7

传说2:

  • 结果 <= 1.4

  • 1.4 < 结果 <= 2.8

  • 2.8 < 结果 <= 4.2

  • 4.2 < 结果 <= 5.6

  • 结果 > 5.6

我对第一个传说的问题是,我会在视觉上欺骗我的观众,让他们认为极端价值观比实际更普遍。我对第二个图例的问题是我的结果值不是连续的,所以实际上第二个图例看起来像这样:

  • 结果 = 1

  • 结果 = 2

  • 结果 = 3 - 4

  • 结果 = 5

  • 结果 = 6 - 7

同样,我的数据会在视觉上出现偏差并欺骗我的观众。

处理这种情况的正确方法是什么?或者任何类似的情况(例如 9 或 11 或 13 个结果值)?

谢谢!

1个回答

您不必使用相同颜色的阴影。如果它们之间有足够的对比度,您可以保留 7 种颜色。

配色方案"Gradient"用于选择 7 种颜色。"Indexed"ColorData

一些例子包括。

Wolfram 语言中

BarLegend[{#, {0, 7}}, Range@7,
    LegendLabel -> #,
    LegendLayout -> "Row"] & /@
  {"BrightBands", "DarkBands", "Rainbow", "LightTemperatureMap", "TemperatureMap", "ThermometerColors"} //
 Multicolumn[#, 3] &

数学图形

BarLegend[{#, {0, 7}}, Range@7,
    LegendLabel -> Last@ColorData[#, "AlternateNames"] <> " (" <> ToString@# <> ")",
    LegendLayout -> "Row"] & /@
  {96, 109, 110, 111} //
 Multicolumn[#, 2] &

数学图形

需要设置ColorFunctionScalingand选项才能使用该方案。ColorFunction

BarChart[Range@7,
 ColorFunctionScaling -> False,
 ColorFunction -> ColorData[{"TemperatureMap", {0, 7}}]
 ]

数学图形

对于大量离散值,"Gradient"可以使用配色方案而不限制等高线的数量。

例如

Plot[x, {x, 0, 41},
    ColorFunctionScaling -> False,
    ColorFunction -> ColorData[{#, {0, 41}}],
    PlotLabel -> #,
    Filling -> Axis,
    PlotLegends -> Automatic,
    ImageSize -> Medium
    ] & /@ {"TemperatureMap", "ThermometerColors"} //
 Column

数学图形

希望这可以帮助。