MathGroup Archive 2013

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

Search the Archive

Re: Multiple Line coloring and Dashing in ListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131430] Re: Multiple Line coloring and Dashing in ListPlot
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Fri, 5 Jul 2013 06:02:06 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Dear Mathematica Users,

I have a question about the coloring and dashing lines in listplot.
For example, Let's say there is a multiple data set like
data = Table[RandomReal[{2 i, 2 i + 1}, {20}], {i, 9}];

I want to plot them in listplot or listloglogplot with all different color and all different dashing with (joined -> True).
How can I do it automatically or minimum option?
The default number of coloring in mathematica (I am in still 8) is 4. after that, it repeat same color.

please help me!

Thanks!



There are several such possibilities to make different colors. The most straightforward is as follows:

data = Table[RandomReal[{2 i, 2 i + 1}, {20}], {i, 9}];

ListPlot[data, Joined -> True, PlotStyle -> Table[Hue[i/9], {i, 1, 9}]]

Try it.

You may use the RGBColor as well:

ListPlot[data, Joined -> True, PlotStyle -> Table[RGBColor[i/9, 0, 1 - i/9] , {i, 1, 9}]]

try various combinations of colour variation: RGBColor[i/9, 0, 1], RGBColor[0, 0, 1 - i/9],
RGBColor[0, i/9, 1 - i/9] and so on. Try it.


You may as well use a ColorData:

ListPlot[data, Joined -> True, PlotStyle -> Table[ColorData[3, "ColorList"][i/9], {i, 1, 9}]]

and look, e.g. into ColorData  with different numbers.



However, if it is something I really care how it looks like, I do it "by hand":

ListPlot[data, Joined -> True, PlotStyle -> {Red, Blue, Green, Brown, Pink,Cyan, Magenta, Gray,
   Orange}]

You have also possibility of using Darker[ ] function:

ListPlot[data, Joined -> True,  PlotStyle -> {Red, Darker[Red, 0.5], Blue, Darker[Blue, 0.5], Green,
   Darker[Green, 0.5], Pink, Darker[Pink, 0.5], Cyan}]

 Try it.

Have fun. Alexei



Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Re: Multiple Line coloring and Dashing in ListPlot
  • Next by Date: Re: Define function using lists or tables
  • Previous by thread: Re: Multiple Line coloring and Dashing in ListPlot
  • Next by thread: Re: Multiple Line coloring and Dashing in ListPlot