Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2013

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

Search the Archive

Re: Multiple Line coloring and Dashing in ListPlot

  • To: mathgroup at
  • Subject: [mg131435] Re: Multiple Line coloring and Dashing in ListPlot
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Sat, 6 Jul 2013 05:02:26 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

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!


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,

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.
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

  • Prev by Date: Re: Multiple Line coloring and Dashing in ListPlot
  • Next by Date: Problems Exporting to LaTeX, Windows 8, Mathematica 9
  • Previous by thread: Re: Multiple Line coloring and Dashing in ListPlot
  • Next by thread: Calculating derivate in Mathematica 9 giving wrong result