A fairly common challenge I encounter is the need for more plot colors. I have too many lines on my plot, and MATLAB begins to cycle back through colors it has already used. There are plenty of coping mechanisms for the situation. When I’ve cobbled my own solution together in the past, I always encounter a related challenge of deciding what extra colors to add. I’ve often found myself on a website toying with RGB values till I settle on one I like.
Stephen’s submission provides an easy way to use determine an RGB combination based on a recognizable name. You choose from one of 28 palettes, each of which contain a lexicon of color names to choose from. I went with xkcd, which contains 949 preconfigured colors, everything from “Yellowy Green” to “Yellow/Green” to “Yellowish Green.” (There are some non-yellow/green ones too). Want to know what they look like, call COLORNAMES_VIEW to get a figure window browser:
Once you have a color that speaks to you, you can call COLORNAMES to get the RGB vector that corresponds to it. I flipped the output arguments around so that I could inline a call directly in a plot command. Turns out this is what a sine wave of dried blood looks like:
One fact that really impressed me is that Stephen continues to support this submission more than 4 years after he first uploaded it. Just last month, he tweaked it for R2018b compatibility. Major kudos for maintaining your work!
Two minor suggestions I would offer for the next update. One would be to include support for strings in addition to character arrays. And also consider adding Sherwin-Williams as a palette. Nothing will be more amusing than to plot with Brainstorm Bronze or Bungalow Beige.
Comments are closed.