如何自动选择n种不同的颜色来绘制n个不同的对象?

发布于 2024-09-30 21:09:28 字数 153 浏览 6 评论 0原文

我需要在图表上绘制 n 个不同的对象。我想为每个人选择不同的颜色,以便区分它们。对象将被移动,所以我不能指望像“四色定理”这样的想法来为不相邻的项目分配相同的颜色。到目前为止,我的问题需要多达 20 个不同的项目。

有没有一个好方法来选择n种不同的颜色,使它们尽可能彼此区分?

I need to draw n different objects on a chart. I want to pick a different color for each of them to make them distinguishable. The objects will be moved around, so I cannot count on ideas like "four color theorem" to assign same color to non-adjacent items. So far my problem call for up to 20 different items.

Is there a good way to pick n different colors to make them as distinguishable from each other as possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白昼 2024-10-07 21:09:28

首先,我改变了设计,这样使用 20 种不同的颜色就不再重要了。默认的 10 种颜色调色板显示得很好。

其次,我找到了自己问题的答案。我想做的事情称为用于分类编码的色标。这里有一篇论文提出了一种方法来实现这一点:

一种为分类和序数编码生成色阶的算法 - Breslow - 2009 - Color Research &应用程序 - Wiley 在线图书馆
http://onlinelibrary.wiley.com/doi/10.1002/col.20559/full

我要浏览一下这篇论文。这可能比我准备做的技术性太强。

First of all, I have since changed the design so that it is not important to use 20 distinct colors. The default palette of 10 colors show up quite well.

Secondly, I've found an answer to my own question. The thing I want to do is called Color scale for categorical coding. Here is a paper that propose a method to do it

An algorithm for generating color scales for both categorical and ordinal coding - Breslow - 2009 - Color Research & Application - Wiley Online Library
http://onlinelibrary.wiley.com/doi/10.1002/col.20559/full

I'm going to give the paper a glance. It is probably too technical than what I prepare to do.

违心° 2024-10-07 21:09:28

我想说颜色区分是一个非常主观的问题,您最好寻找现有的调色板并从那里开始工作。 n 越高,用户无法区分两种自动生成的颜色的可能性就越大,即使根据某些颜色理论标准,它们非常不同。

并且不要忘记确保您不使用颜色作为物体之间的唯一区别,否则:

  • 您将收到来自色盲人士的大量仇恨邮件,
  • 您可能会冒着人们将相似颜色的物体误认为具有某种颜色的风险。隐式分组

I'd say colour distinction is a very subjective matter and you're probably better off looking for an existing colour palette and working your way from there. The higher your n, the higher your chance of two automatically generated colours being indistinguishable by your users even though by some colour-theoretic criterion they are very different.

And don't forget to make sure you don't use colour as the only distinction between objects, or:

  • you'll be in for a lot of hate mail from colour blind people
  • you risk people mistaking objects of similar colours as having some sort of implicit grouping
独孤求败 2024-10-07 21:09:28

你真的需要使用 20 种不同的颜色吗?如果你仍然希望人们能够区分它们,那就有很多颜色了。还要意识到,色盲的人在查看您的图表时会迷失方向。 10% 的男性是色盲。如果你能将你的对象进一步分解为两到五组,那就更好了。然后你可以使用不同的形状和颜色来区分物体。例如,您可能有四种不同颜色的十字形、圆形、三角形、星形和正方形,如下所示:
alt text

对于颜色的选择,我会查看 彩色啤酒。但请注意,它最多不会有 20 种颜色。

Do you really need to use 20 different colors? That is a lot of colors if you still want people to be able to distinguish them. Also realize that people who are colorblind will be lost looking at your charts. 10% of males are color blind. It would be better if you could further break down your objects into two to five groups. Then you could use different shapes as well as color to distinguish objects. For instance, you might have crosses, circles, triangles, stars, and squares of four different colors as shown here:
alt text

For choice of colors, I would check out the color brewer. However, notice it doesn't go up to 20 colors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文