Re: Q: Print in different colors
- To: mathgroup at smc.vnet.net
- Subject: [mg27949] Re: [mg27930] Q: Print in different colors
- From: BobHanlon at aol.com
- Date: Sat, 24 Mar 2001 15:15:52 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Recommend that you use a Legend; however, I show both ways
Needs["Graphics`Legend`"];
c = {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0,0,1]};
SetOptions[Plot, PlotStyle -> c];
Plot[{Sin[x], Sin[2x], Sin[3x]}, {x, 0, Pi},
PlotLabel ->
StyleForm["Sin[k*x]", FontWeight -> "Bold", FontSize -> 14],
Ticks -> {PiScale, Automatic},
PlotLegend -> Table["k = " <> ToString[k], {k, 3}],
LegendPosition -> {1.1, -.4},
ImageSize -> 2.5*{200, 86}];
Print[StyleForm["k = ", FontSize -> 14],
Table[StyleForm[k, FontColor -> c[[k]], FontSize -> 14], {k, 3}]];
Bob Hanlon
In a message dated 2001/3/24 1:16:44 AM, robert.schuerhuber at gmx.at writes:
>some time again i managed it with the help of this group to cycle the
>colors of a plot automatically, when i plot a list. i'm printing the
>information about the curves below the plot, and it would be very
>helpful if this information would be in the same color as the plot,
>because sometimes its very hard to say which curve belongs to which
>paramter. i'll give a simple example:
>
>c = {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0,0,1]};
>SetOptions[Plot, PlotStyle -> c];
>Plot[{Sin[1 x],Sin[3 x],Sin[3 x]},{x,0,Pi}]
>k={1,2,3};
>Print["k=",k];
>
>so the three curves are plotted in red, green and blue, respectively,
>and i'd like the "k"-list printed in the next line also to appear in the
>same color, therefore "1" printed in red, "2" in green and "3" in blue.
>is there a way to do this, it would really save me a lot of time!
>