I am wondering if in R there is a per-existing package that can colorate sets inside graph or a package that can generate a list of colors that are not close, Because I have a graph that have many clusters and I want to color but I don't want to colors to be close. I have found a nice answer here but I am wondering if there is a per-existing package for
Asked
Active
Viewed 507 times
2 Answers
8
You may also want to check out the package RColorBrewer for other built in color palettes. However, you may run into issues if you need large numbers of colours. There is a nice post on CrossValidated which addresses the large n issue and offers a few nice solutions as well. Specifically, would it make sense to facet your plot based on some large groupings? Do you need to plot all of the items at once? ggplot2 makes it easy to facet based on a column in your data. I'm sure there are equivalent functions in base graphics and lattice, but I'm not as familiar with them.
-
Well, in fact I don't want to plot the graph on R but I want to color the nodes and then save it in graph representation format, let's say gml and then open it with some graph manipulation softwares. because my network has thousands of noeds. – sirus Dec 08 '10 at 07:26
3
See the functions rainbow, heat.colors, terrain.colors etc, described in the help pages (?rainbow). These are part of the grDevices package, which is installed by default.

Tyler
- 9,872
- 2
- 33
- 57
-
-
I tried them all, well rainbow seems acceptable but the problem is that I have a large number of clusters and the colors are a bit continues. I tried to shuffle colors to get more distinct colors but for large number of clusters some of them seems to have the same color – sirus Dec 08 '10 at 01:38
-
How many clusters are you talking about? There's a limit to how many colors you can distinguish on a busy graph, so maybe you want to combine colors with symbols. If you use the 8 base colors provided by R, combined with 7 distinct characters, you'll have 56 distinct combinations to use. Try: plot(1:56, col=1:8, pch=1:7) – Tyler Dec 08 '10 at 02:03
-
I can have up to 450 clusters in my graph, because I have to many noeds about 2400 noed. – sirus Dec 08 '10 at 07:27