MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Getting Color *names* as strings?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67490] Re: [mg67473] Getting Color *names* as strings?
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Wed, 28 Jun 2006 03:51:49 -0400 (EDT)
  • References: <200606270714.DAA06647@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

AES wrote:
> Trying out different named Colors in a plot by using
> 
>    greens={CinnabarGreen, ChromeOxideGreen, CobaltGreen, etc};
> 
>    Do[ Plot[ func, range, PlotStyle -> greens[[k]],
>                     PlotLabel -> ToString[greens[[k]]] ] , 
>          {k, 1, Length[greens]} ];
> 
> Works fine -- except the PlotLabel comes out as "RGB[num, num, num]" -- 
> and using SymbolName[greens[[1]]] or even SymbolName[CinnabarGreen] does 
> _not_ give the string "CinnabarGreen".
> 
> How can I get the *name* of each color as a string to put in PlotLabel 
> or in a Text label?
> 
> (Trivial problem, I agree, but just frustrating enough to be interesting)

The simple answer is to use strings in the definition of greens:

greens = {"CinnabarGreen", "ChromeOxideGreen", etc.}

Do[
   Plot[
     func,
     range,
     PlotStyle->ToExpression[greens[[k]]],
     PlotLabel->greens[[k]]
   ], {k, Length[greens]}
]

Carl Woll
Wolfram Research


  • Prev by Date: Re: Getting Color *names* as strings?
  • Next by Date: Re: Listing ALL Options for a mathematica Function
  • Previous by thread: Re: Getting Color *names* as strings?
  • Next by thread: Solving an equation