I make some fake data to illustrate my question:

This is the phone in Chinese:

phone = {"a", "ai", "an", "ang", "ao", "b", "c", "ch", "d", "e", "ei",
         "en", "eng", "er", "f", "g", "h", "i", "ia", "ian", "iang", "iao", 
         "ie", "ii", "iii", "in", "ing", "iong", "iou", "j", "k", "l", "m", 
         "n", "o", "ong", "ou", "p", "q", "r", "s", "sh", "sil", "sp", "t", 
         "u", "ua", "uai", "uan", "uang", "uei", "uen", "ueng", "uo", "v", 
         "van", "ve", "vn", "x", "z", "zh"}

Let every phone in phone list have a vector that is similar phone has similar vector

data = Table[RandomVariate[
              NormalDistribution[u, 0.3], {100, 2}], 
              {u, (ToCharacterCode[#][[1]] - 97) + 0.5*RandomReal[] & /@ phone}];

ListPlot[data, PlotLegends -> PointLegend[97, phone, LegendMarkerSize -> 15]]

(*ListPlot[data, PlotLegends -> PointLegend[97, phone, LegendMarkerSize -> 15], 
  ColorFunctionScaling -> False]*)
(*Nothing changed*)

You can find that there are many color are similar even it looks different.(marked in Box)

enter image description here

I want the color look like this that similar phone has similar color(marked in Box)

enter image description here

The color of ListPlot according to the PlotLegends maybe like this(the color is not beautiful~)

          Table[{ColorData["TemperatureMap", t/Length@phone], 
          Text[phone[[t]], {2 t, 1.5}, {-1, 0}, {0, 1}], 
          Disk[{2 t, 0}, .9]}, {t, Length@phone}]}]

enter image description here

How to do this?

  • $\begingroup$ Are the blocks you marked the only similar phonemes in Mandarin? $\endgroup$ – J. M. will be back soon Nov 10 '17 at 2:56
  • $\begingroup$ @J.M. No,it's similar but not all. I only want the color from a to zh has changed gradually $\endgroup$ – partida Nov 10 '17 at 3:00
  • $\begingroup$ Then, you could just do something like PointLegend[ColorData["TemperatureMap"] /@ Subdivide[Length[phone] - 1], phone]. $\endgroup$ – J. M. will be back soon Nov 10 '17 at 3:14
  • $\begingroup$ @J.M. But the color of ListPlot can't match the color in PointLegend $\endgroup$ – partida Nov 10 '17 at 3:22

I think maybe you are looking for one of the gradient color schemes? Since you are specifying the legend manually, you'll need to also specify the styles manually to enforce consistency between them.

$scheme = "Rainbow";

 , PlotLegends -> PointLegend[$scheme, phone, LegendMarkerSize -> 15]
 , PlotStyle -> Map[ColorData[$scheme], Rescale @ Range[Length @ phone]]

enter image description here

  • $\begingroup$ Wow Exactly what I want ! That's beautiful Thank you! $\endgroup$ – partida Nov 10 '17 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.